Built motion from commit (unavailable).|2.4.19
[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 _0x5e40=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','map','include','model','stringify','ShowServicenowAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x4a7269,_0x887887){var _0xc7154=function(_0x3fb2c1){while(--_0x3fb2c1){_0x4a7269['push'](_0x4a7269['shift']());}};_0xc7154(++_0x887887);}(_0x5e40,0xe4));var _0x05e4=function(_0x19e0f0,_0x2fa57f){_0x19e0f0=_0x19e0f0-0x0;var _0xb46f54=_0x5e40[_0x19e0f0];return _0xb46f54;};'use strict';var _=require(_0x05e4('0x0'));var util=require(_0x05e4('0x1'));var moment=require(_0x05e4('0x2'));var BPromise=require(_0x05e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05e4('0x4'));var db=require(_0x05e4('0x5'))['db'];var utils=require(_0x05e4('0x6'));var logger=require(_0x05e4('0x7'))(_0x05e4('0x8'));var config=require(_0x05e4('0x9'));var jayson=require(_0x05e4('0xa'));var client=jayson[_0x05e4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3cf0,_0x3184cf,_0x1b896f){return new BPromise(function(_0x3bf710,_0x3cbe14){return client[_0x05e4('0xc')](_0x2a3cf0,_0x1b896f)[_0x05e4('0xd')](function(_0x459e4e){logger[_0x05e4('0xe')](_0x05e4('0xf'),_0x3184cf,'request\x20sent');logger[_0x05e4('0x10')](_0x05e4('0x11'),_0x3184cf,_0x05e4('0x12'),JSON['stringify'](_0x459e4e));if(_0x459e4e[_0x05e4('0x13')]){if(_0x459e4e['error'][_0x05e4('0x14')]===0x1f4){logger[_0x05e4('0x13')](_0x05e4('0xf'),_0x3184cf,_0x459e4e['error'][_0x05e4('0x15')]);return _0x3cbe14(_0x459e4e[_0x05e4('0x13')]['message']);}logger[_0x05e4('0x13')](_0x05e4('0xf'),_0x3184cf,_0x459e4e['error']['message']);return _0x3bf710(_0x459e4e[_0x05e4('0x13')]['message']);}else{logger[_0x05e4('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3184cf,_0x05e4('0x12'));_0x3bf710(_0x459e4e[_0x05e4('0x16')][_0x05e4('0x15')]);}})[_0x05e4('0x17')](function(_0x1304ba){logger['error'](_0x05e4('0xf'),_0x3184cf,_0x1304ba);_0x3cbe14(_0x1304ba);});});}exports[_0x05e4('0x18')]=function(_0x584f38){var _0x435327=this;return new Promise(function(_0x5eec31,_0x25dc5c){return db[_0x05e4('0x19')][_0x05e4('0x1a')]({'raw':_0x584f38[_0x05e4('0x1b')]?_0x584f38[_0x05e4('0x1b')][_0x05e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x584f38['options']?_0x584f38[_0x05e4('0x1b')]['where']||null:null,'attributes':_0x584f38[_0x05e4('0x1b')]?_0x584f38[_0x05e4('0x1b')][_0x05e4('0x1d')]||null:null,'limit':_0x584f38[_0x05e4('0x1b')]?_0x584f38[_0x05e4('0x1b')]['limit']||null:null,'include':_0x584f38['options']?_0x584f38[_0x05e4('0x1b')]['include']?_[_0x05e4('0x1e')](_0x584f38[_0x05e4('0x1b')][_0x05e4('0x1f')],function(_0x26d55e){return{'model':db[_0x26d55e[_0x05e4('0x20')]],'as':_0x26d55e['as'],'attributes':_0x26d55e['attributes'],'include':_0x26d55e['include']?_[_0x05e4('0x1e')](_0x26d55e[_0x05e4('0x1f')],function(_0x2f6c47){return{'model':db[_0x2f6c47[_0x05e4('0x20')]],'as':_0x2f6c47['as'],'attributes':_0x2f6c47['attributes'],'include':_0x2f6c47['include']?_[_0x05e4('0x1e')](_0x2f6c47[_0x05e4('0x1f')],function(_0x184834){return{'model':db[_0x184834['model']],'as':_0x184834['as'],'attributes':_0x184834[_0x05e4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x05e4('0xd')](function(_0x199b97){logger[_0x05e4('0xe')]('GetServicenowAccount',_0x584f38);logger[_0x05e4('0x10')](_0x05e4('0x18'),_0x584f38,JSON[_0x05e4('0x21')](_0x199b97));_0x5eec31(_0x199b97);})[_0x05e4('0x17')](function(_0x4a9028){logger[_0x05e4('0x13')]('GetServicenowAccount',_0x4a9028[_0x05e4('0x15')],_0x584f38);_0x25dc5c(_0x435327[_0x05e4('0x13')](0x1f4,_0x4a9028[_0x05e4('0x15')]));});});};exports[_0x05e4('0x22')]=function(_0x384250){var _0xfd62e1=this;return new Promise(function(_0x41a578,_0x256e52){return db['ServicenowAccount']['find']({'raw':_0x384250[_0x05e4('0x1b')]?_0x384250['options'][_0x05e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x384250['options']?_0x384250[_0x05e4('0x1b')][_0x05e4('0x23')]||null:null,'attributes':_0x384250[_0x05e4('0x1b')]?_0x384250[_0x05e4('0x1b')]['attributes']||null:null,'include':_0x384250[_0x05e4('0x1b')]?_0x384250[_0x05e4('0x1b')][_0x05e4('0x1f')]?_[_0x05e4('0x1e')](_0x384250[_0x05e4('0x1b')][_0x05e4('0x1f')],function(_0x32c813){return{'model':db[_0x32c813[_0x05e4('0x20')]],'as':_0x32c813['as'],'attributes':_0x32c813[_0x05e4('0x1d')],'include':_0x32c813['include']?_['map'](_0x32c813[_0x05e4('0x1f')],function(_0xa91e98){return{'model':db[_0xa91e98[_0x05e4('0x20')]],'as':_0xa91e98['as'],'attributes':_0xa91e98[_0x05e4('0x1d')],'include':_0xa91e98['include']?_[_0x05e4('0x1e')](_0xa91e98[_0x05e4('0x1f')],function(_0x16d73f){return{'model':db[_0x16d73f[_0x05e4('0x20')]],'as':_0x16d73f['as'],'attributes':_0x16d73f[_0x05e4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x05e4('0xd')](function(_0x2541e9){logger[_0x05e4('0xe')](_0x05e4('0x22'),_0x384250);logger[_0x05e4('0x10')](_0x05e4('0x22'),_0x384250,JSON[_0x05e4('0x21')](_0x2541e9));_0x41a578(_0x2541e9);})[_0x05e4('0x17')](function(_0x78c111){logger[_0x05e4('0x13')]('ShowServicenowAccount',_0x78c111[_0x05e4('0x15')],_0x384250);_0x256e52(_0xfd62e1[_0x05e4('0x13')](0x1f4,_0x78c111[_0x05e4('0x15')]));});});};