Built motion from commit (unavailable).|2.6.0
[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 _0xf813=['where','attributes','include','map','model','debug','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw'];(function(_0x5cfcee,_0x392025){var _0x54163f=function(_0x1955a5){while(--_0x1955a5){_0x5cfcee['push'](_0x5cfcee['shift']());}};_0x54163f(++_0x392025);}(_0xf813,0x170));var _0x3f81=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0xf813[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0x3f81('0x0'));var util=require(_0x3f81('0x1'));var moment=require(_0x3f81('0x2'));var BPromise=require(_0x3f81('0x3'));var rs=require(_0x3f81('0x4'));var fs=require('fs');var Redis=require(_0x3f81('0x5'));var db=require(_0x3f81('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f81('0x7'));var config=require(_0x3f81('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f81('0x9')][_0x3f81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3377ef,_0x1482e2,_0x367fa0){return new BPromise(function(_0x4bbb57,_0x1ab86b){return client[_0x3f81('0xb')](_0x3377ef,_0x367fa0)[_0x3f81('0xc')](function(_0x232949){logger[_0x3f81('0xd')](_0x3f81('0xe'),_0x1482e2,'request\x20sent');logger['debug'](_0x3f81('0xf'),_0x1482e2,'request\x20sent',JSON[_0x3f81('0x10')](_0x232949));if(_0x232949[_0x3f81('0x11')]){if(_0x232949[_0x3f81('0x11')][_0x3f81('0x12')]===0x1f4){logger['error'](_0x3f81('0xe'),_0x1482e2,_0x232949[_0x3f81('0x11')][_0x3f81('0x13')]);return _0x1ab86b(_0x232949[_0x3f81('0x11')]['message']);}logger[_0x3f81('0x11')](_0x3f81('0xe'),_0x1482e2,_0x232949[_0x3f81('0x11')][_0x3f81('0x13')]);return _0x4bbb57(_0x232949[_0x3f81('0x11')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1482e2,_0x3f81('0x14'));_0x4bbb57(_0x232949[_0x3f81('0x15')][_0x3f81('0x13')]);}})[_0x3f81('0x16')](function(_0x1511d1){logger[_0x3f81('0x11')](_0x3f81('0xe'),_0x1482e2,_0x1511d1);_0x1ab86b(_0x1511d1);});});}exports[_0x3f81('0x17')]=function(_0x11915b){var _0x562005=this;return new Promise(function(_0xae83eb,_0x26880c){return db[_0x3f81('0x18')][_0x3f81('0x19')]({'raw':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1b')]===undefined?!![]:![]:!![],'where':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1c')]||null:null,'attributes':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1d')]||null:null,'limit':_0x11915b[_0x3f81('0x1a')]?_0x11915b['options']['limit']||null:null,'include':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1e')],function(_0x1d927b){return{'model':db[_0x1d927b[_0x3f81('0x20')]],'as':_0x1d927b['as'],'attributes':_0x1d927b['attributes'],'include':_0x1d927b[_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x1d927b[_0x3f81('0x1e')],function(_0x239317){return{'model':db[_0x239317[_0x3f81('0x20')]],'as':_0x239317['as'],'attributes':_0x239317[_0x3f81('0x1d')],'include':_0x239317[_0x3f81('0x1e')]?_['map'](_0x239317[_0x3f81('0x1e')],function(_0x253fdf){return{'model':db[_0x253fdf[_0x3f81('0x20')]],'as':_0x253fdf['as'],'attributes':_0x253fdf[_0x3f81('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f81('0xc')](function(_0x33ed40){logger['info']('GetServicenowAccount',_0x11915b);logger[_0x3f81('0x21')](_0x3f81('0x17'),_0x11915b,JSON[_0x3f81('0x10')](_0x33ed40));_0xae83eb(_0x33ed40);})[_0x3f81('0x16')](function(_0x2f96ab){logger[_0x3f81('0x11')](_0x3f81('0x17'),_0x2f96ab['message'],_0x11915b);_0x26880c(_0x562005[_0x3f81('0x11')](0x1f4,_0x2f96ab['message']));});});};exports[_0x3f81('0x22')]=function(_0xe766b1){var _0x46e73a=this;return new Promise(function(_0x3e5572,_0x1706dc){return db[_0x3f81('0x18')][_0x3f81('0x23')]({'raw':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1['options']['raw']===undefined?!![]:![]:!![],'where':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1[_0x3f81('0x1a')][_0x3f81('0x1c')]||null:null,'attributes':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1[_0x3f81('0x1a')][_0x3f81('0x1d')]||null:null,'include':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1['options']['include']?_[_0x3f81('0x1f')](_0xe766b1['options'][_0x3f81('0x1e')],function(_0x237394){return{'model':db[_0x237394[_0x3f81('0x20')]],'as':_0x237394['as'],'attributes':_0x237394[_0x3f81('0x1d')],'include':_0x237394[_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x237394['include'],function(_0x200964){return{'model':db[_0x200964[_0x3f81('0x20')]],'as':_0x200964['as'],'attributes':_0x200964['attributes'],'include':_0x200964[_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x200964[_0x3f81('0x1e')],function(_0x229719){return{'model':db[_0x229719[_0x3f81('0x20')]],'as':_0x229719['as'],'attributes':_0x229719[_0x3f81('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f81('0xc')](function(_0x36ea62){logger[_0x3f81('0xd')](_0x3f81('0x22'),_0xe766b1);logger[_0x3f81('0x21')]('ShowServicenowAccount',_0xe766b1,JSON['stringify'](_0x36ea62));_0x3e5572(_0x36ea62);})[_0x3f81('0x16')](function(_0x55e20b){logger[_0x3f81('0x11')](_0x3f81('0x22'),_0x55e20b[_0x3f81('0x13')],_0xe766b1);_0x1706dc(_0x46e73a['error'](0x1f4,_0x55e20b[_0x3f81('0x13')]));});});};