Built motion from commit (unavailable).|2.5.14
[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 _0x8b64=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowServicenowAccount','debug'];(function(_0x34c4a5,_0x9ac284){var _0x1b8996=function(_0x426e60){while(--_0x426e60){_0x34c4a5['push'](_0x34c4a5['shift']());}};_0x1b8996(++_0x9ac284);}(_0x8b64,0xc6));var _0x48b6=function(_0x28318f,_0x5cd1a2){_0x28318f=_0x28318f-0x0;var _0x4cab17=_0x8b64[_0x28318f];return _0x4cab17;};'use strict';var _=require(_0x48b6('0x0'));var util=require(_0x48b6('0x1'));var moment=require(_0x48b6('0x2'));var BPromise=require('bluebird');var rs=require(_0x48b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x48b6('0x4'));var logger=require(_0x48b6('0x5'))(_0x48b6('0x6'));var config=require(_0x48b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x48b6('0x8')][_0x48b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x152e4e,_0x1f89a9,_0x24643d){return new BPromise(function(_0x290e9a,_0x36d99e){return client[_0x48b6('0xa')](_0x152e4e,_0x24643d)[_0x48b6('0xb')](function(_0x4d244b){logger[_0x48b6('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x1f89a9,'request\x20sent');logger['debug'](_0x48b6('0xd'),_0x1f89a9,'request\x20sent',JSON[_0x48b6('0xe')](_0x4d244b));if(_0x4d244b['error']){if(_0x4d244b[_0x48b6('0xf')]['code']===0x1f4){logger[_0x48b6('0xf')](_0x48b6('0x10'),_0x1f89a9,_0x4d244b[_0x48b6('0xf')]['message']);return _0x36d99e(_0x4d244b[_0x48b6('0xf')][_0x48b6('0x11')]);}logger[_0x48b6('0xf')](_0x48b6('0x10'),_0x1f89a9,_0x4d244b['error']['message']);return _0x290e9a(_0x4d244b[_0x48b6('0xf')]['message']);}else{logger[_0x48b6('0xc')](_0x48b6('0x10'),_0x1f89a9,'request\x20sent');_0x290e9a(_0x4d244b[_0x48b6('0x12')][_0x48b6('0x11')]);}})[_0x48b6('0x13')](function(_0x59a009){logger['error'](_0x48b6('0x10'),_0x1f89a9,_0x59a009);_0x36d99e(_0x59a009);});});}exports[_0x48b6('0x14')]=function(_0x45a171){var _0xb3cc57=this;return new Promise(function(_0x516a3f,_0x2ad831){return db['ServicenowAccount'][_0x48b6('0x15')]({'raw':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x17')]===undefined?!![]:![]:!![],'where':_0x45a171[_0x48b6('0x16')]?_0x45a171['options'][_0x48b6('0x18')]||null:null,'attributes':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x19')]||null:null,'limit':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x1a')]||null:null,'include':_0x45a171['options']?_0x45a171[_0x48b6('0x16')]['include']?_[_0x48b6('0x1b')](_0x45a171['options'][_0x48b6('0x1c')],function(_0x1f0d30){return{'model':db[_0x1f0d30['model']],'as':_0x1f0d30['as'],'attributes':_0x1f0d30['attributes'],'include':_0x1f0d30[_0x48b6('0x1c')]?_['map'](_0x1f0d30['include'],function(_0x6c70e4){return{'model':db[_0x6c70e4[_0x48b6('0x1d')]],'as':_0x6c70e4['as'],'attributes':_0x6c70e4[_0x48b6('0x19')],'include':_0x6c70e4['include']?_['map'](_0x6c70e4[_0x48b6('0x1c')],function(_0x29c9da){return{'model':db[_0x29c9da[_0x48b6('0x1d')]],'as':_0x29c9da['as'],'attributes':_0x29c9da['attributes']};}):[]};}):[]};}):[]:[]})[_0x48b6('0xb')](function(_0x35470e){logger['info']('GetServicenowAccount',_0x45a171);logger['debug'](_0x48b6('0x14'),_0x45a171,JSON[_0x48b6('0xe')](_0x35470e));_0x516a3f(_0x35470e);})[_0x48b6('0x13')](function(_0x131473){logger[_0x48b6('0xf')](_0x48b6('0x14'),_0x131473[_0x48b6('0x11')],_0x45a171);_0x2ad831(_0xb3cc57[_0x48b6('0xf')](0x1f4,_0x131473[_0x48b6('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x49b08c){var _0x19f001=this;return new Promise(function(_0x48cef3,_0x3fabae){return db['ServicenowAccount'][_0x48b6('0x1e')]({'raw':_0x49b08c['options']?_0x49b08c[_0x48b6('0x16')][_0x48b6('0x17')]===undefined?!![]:![]:!![],'where':_0x49b08c[_0x48b6('0x16')]?_0x49b08c[_0x48b6('0x16')]['where']||null:null,'attributes':_0x49b08c[_0x48b6('0x16')]?_0x49b08c['options'][_0x48b6('0x19')]||null:null,'include':_0x49b08c[_0x48b6('0x16')]?_0x49b08c[_0x48b6('0x16')]['include']?_['map'](_0x49b08c[_0x48b6('0x16')][_0x48b6('0x1c')],function(_0x530d46){return{'model':db[_0x530d46['model']],'as':_0x530d46['as'],'attributes':_0x530d46[_0x48b6('0x19')],'include':_0x530d46[_0x48b6('0x1c')]?_['map'](_0x530d46['include'],function(_0x10bad5){return{'model':db[_0x10bad5[_0x48b6('0x1d')]],'as':_0x10bad5['as'],'attributes':_0x10bad5[_0x48b6('0x19')],'include':_0x10bad5['include']?_[_0x48b6('0x1b')](_0x10bad5[_0x48b6('0x1c')],function(_0x581f23){return{'model':db[_0x581f23[_0x48b6('0x1d')]],'as':_0x581f23['as'],'attributes':_0x581f23[_0x48b6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x48b6('0xb')](function(_0x5c2395){logger[_0x48b6('0xc')](_0x48b6('0x1f'),_0x49b08c);logger[_0x48b6('0x20')](_0x48b6('0x1f'),_0x49b08c,JSON[_0x48b6('0xe')](_0x5c2395));_0x48cef3(_0x5c2395);})[_0x48b6('0x13')](function(_0x1dafc2){logger[_0x48b6('0xf')](_0x48b6('0x1f'),_0x1dafc2[_0x48b6('0x11')],_0x49b08c);_0x3fabae(_0x19f001[_0x48b6('0xf')](0x1f4,_0x1dafc2['message']));});});};