Built motion from commit 2b9af5da.|2.6.26
[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 _0x4c81=['raw','where','attributes','limit','include','map','model','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4c81,0x194));var _0x14c8=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4c81[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x14c8('0x0'));var util=require(_0x14c8('0x1'));var moment=require(_0x14c8('0x2'));var BPromise=require(_0x14c8('0x3'));var rs=require(_0x14c8('0x4'));var fs=require('fs');var Redis=require(_0x14c8('0x5'));var db=require(_0x14c8('0x6'))['db'];var utils=require(_0x14c8('0x7'));var logger=require(_0x14c8('0x8'))(_0x14c8('0x9'));var config=require('../../config/environment');var jayson=require(_0x14c8('0xa'));var client=jayson[_0x14c8('0xb')][_0x14c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fa895,_0x480ceb,_0x2475ec){return new BPromise(function(_0x4fe9f5,_0x24d97f){return client['request'](_0x2fa895,_0x2475ec)[_0x14c8('0xd')](function(_0x25c8b4){logger[_0x14c8('0xe')](_0x14c8('0xf'),_0x480ceb,_0x14c8('0x10'));logger[_0x14c8('0x11')](_0x14c8('0x12'),_0x480ceb,_0x14c8('0x10'),JSON[_0x14c8('0x13')](_0x25c8b4));if(_0x25c8b4[_0x14c8('0x14')]){if(_0x25c8b4['error'][_0x14c8('0x15')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x480ceb,_0x25c8b4[_0x14c8('0x14')]['message']);return _0x24d97f(_0x25c8b4['error']['message']);}logger[_0x14c8('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x480ceb,_0x25c8b4[_0x14c8('0x14')][_0x14c8('0x16')]);return _0x4fe9f5(_0x25c8b4[_0x14c8('0x14')][_0x14c8('0x16')]);}else{logger[_0x14c8('0xe')](_0x14c8('0xf'),_0x480ceb,_0x14c8('0x10'));_0x4fe9f5(_0x25c8b4['result'][_0x14c8('0x16')]);}})[_0x14c8('0x17')](function(_0x2743b6){logger['error'](_0x14c8('0xf'),_0x480ceb,_0x2743b6);_0x24d97f(_0x2743b6);});});}exports[_0x14c8('0x18')]=function(_0x520c54){var _0x241de7=this;return new Promise(function(_0x38e7a1,_0x261325){return db[_0x14c8('0x19')][_0x14c8('0x1a')]({'raw':_0x520c54[_0x14c8('0x1b')]?_0x520c54[_0x14c8('0x1b')][_0x14c8('0x1c')]===undefined?!![]:![]:!![],'where':_0x520c54['options']?_0x520c54[_0x14c8('0x1b')][_0x14c8('0x1d')]||null:null,'attributes':_0x520c54[_0x14c8('0x1b')]?_0x520c54[_0x14c8('0x1b')][_0x14c8('0x1e')]||null:null,'limit':_0x520c54['options']?_0x520c54['options'][_0x14c8('0x1f')]||null:null,'include':_0x520c54[_0x14c8('0x1b')]?_0x520c54['options'][_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x520c54[_0x14c8('0x1b')]['include'],function(_0x18f334){return{'model':db[_0x18f334['model']],'as':_0x18f334['as'],'attributes':_0x18f334[_0x14c8('0x1e')],'include':_0x18f334[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x18f334['include'],function(_0x4e69f0){return{'model':db[_0x4e69f0[_0x14c8('0x22')]],'as':_0x4e69f0['as'],'attributes':_0x4e69f0['attributes'],'include':_0x4e69f0[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x4e69f0[_0x14c8('0x20')],function(_0x1e0b1a){return{'model':db[_0x1e0b1a[_0x14c8('0x22')]],'as':_0x1e0b1a['as'],'attributes':_0x1e0b1a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x221367){logger[_0x14c8('0xe')](_0x14c8('0x18'),_0x520c54);logger['debug'](_0x14c8('0x18'),_0x520c54,JSON[_0x14c8('0x13')](_0x221367));_0x38e7a1(_0x221367);})[_0x14c8('0x17')](function(_0x5d78fe){logger[_0x14c8('0x14')](_0x14c8('0x18'),_0x5d78fe[_0x14c8('0x16')],_0x520c54);_0x261325(_0x241de7[_0x14c8('0x14')](0x1f4,_0x5d78fe[_0x14c8('0x16')]));});});};exports[_0x14c8('0x23')]=function(_0x58eb8f){var _0x24239b=this;return new Promise(function(_0x14b1ef,_0x35f88a){return db[_0x14c8('0x19')]['find']({'raw':_0x58eb8f[_0x14c8('0x1b')]?_0x58eb8f[_0x14c8('0x1b')][_0x14c8('0x1c')]===undefined?!![]:![]:!![],'where':_0x58eb8f['options']?_0x58eb8f[_0x14c8('0x1b')]['where']||null:null,'attributes':_0x58eb8f[_0x14c8('0x1b')]?_0x58eb8f[_0x14c8('0x1b')][_0x14c8('0x1e')]||null:null,'include':_0x58eb8f[_0x14c8('0x1b')]?_0x58eb8f['options'][_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x58eb8f[_0x14c8('0x1b')][_0x14c8('0x20')],function(_0x207854){return{'model':db[_0x207854[_0x14c8('0x22')]],'as':_0x207854['as'],'attributes':_0x207854[_0x14c8('0x1e')],'include':_0x207854[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x207854[_0x14c8('0x20')],function(_0x6279c4){return{'model':db[_0x6279c4[_0x14c8('0x22')]],'as':_0x6279c4['as'],'attributes':_0x6279c4['attributes'],'include':_0x6279c4[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x6279c4[_0x14c8('0x20')],function(_0x25b0c2){return{'model':db[_0x25b0c2[_0x14c8('0x22')]],'as':_0x25b0c2['as'],'attributes':_0x25b0c2[_0x14c8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14c8('0xd')](function(_0x4b4f03){logger['info'](_0x14c8('0x23'),_0x58eb8f);logger[_0x14c8('0x11')]('ShowServicenowAccount',_0x58eb8f,JSON[_0x14c8('0x13')](_0x4b4f03));_0x14b1ef(_0x4b4f03);})['catch'](function(_0x5f2233){logger[_0x14c8('0x14')](_0x14c8('0x23'),_0x5f2233[_0x14c8('0x16')],_0x58eb8f);_0x35f88a(_0x24239b[_0x14c8('0x14')](0x1f4,_0x5f2233[_0x14c8('0x16')]));});});};