Built motion from commit f25620e4.|2.6.30
[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 _0xd61a=['ServicenowAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount'];(function(_0x36acad,_0x52944d){var _0x370eb5=function(_0xa1da57){while(--_0xa1da57){_0x36acad['push'](_0x36acad['shift']());}};_0x370eb5(++_0x52944d);}(_0xd61a,0x133));var _0xad61=function(_0x37a505,_0x319129){_0x37a505=_0x37a505-0x0;var _0x5d094e=_0xd61a[_0x37a505];return _0x5d094e;};'use strict';var _=require(_0xad61('0x0'));var util=require(_0xad61('0x1'));var moment=require(_0xad61('0x2'));var BPromise=require('bluebird');var rs=require(_0xad61('0x3'));var fs=require('fs');var Redis=require(_0xad61('0x4'));var db=require(_0xad61('0x5'))['db'];var utils=require(_0xad61('0x6'));var logger=require(_0xad61('0x7'))(_0xad61('0x8'));var config=require(_0xad61('0x9'));var jayson=require(_0xad61('0xa'));var client=jayson[_0xad61('0xb')][_0xad61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd943cc,_0x47dd38,_0x312d21){return new BPromise(function(_0x20b559,_0x9543fa){return client['request'](_0xd943cc,_0x312d21)[_0xad61('0xd')](function(_0x24f63d){logger[_0xad61('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x47dd38,_0xad61('0xf'));logger[_0xad61('0x10')](_0xad61('0x11'),_0x47dd38,_0xad61('0xf'),JSON['stringify'](_0x24f63d));if(_0x24f63d[_0xad61('0x12')]){if(_0x24f63d['error'][_0xad61('0x13')]===0x1f4){logger[_0xad61('0x12')](_0xad61('0x14'),_0x47dd38,_0x24f63d[_0xad61('0x12')][_0xad61('0x15')]);return _0x9543fa(_0x24f63d[_0xad61('0x12')][_0xad61('0x15')]);}logger[_0xad61('0x12')](_0xad61('0x14'),_0x47dd38,_0x24f63d['error']['message']);return _0x20b559(_0x24f63d[_0xad61('0x12')][_0xad61('0x15')]);}else{logger[_0xad61('0xe')](_0xad61('0x14'),_0x47dd38,_0xad61('0xf'));_0x20b559(_0x24f63d[_0xad61('0x16')]['message']);}})[_0xad61('0x17')](function(_0xe4d07e){logger[_0xad61('0x12')](_0xad61('0x14'),_0x47dd38,_0xe4d07e);_0x9543fa(_0xe4d07e);});});}exports[_0xad61('0x18')]=function(_0x242383){var _0x41b4d9=this;return new Promise(function(_0x31425e,_0x5b5329){return db['ServicenowAccount'][_0xad61('0x19')]({'raw':_0x242383[_0xad61('0x1a')]?_0x242383['options']['raw']===undefined?!![]:![]:!![],'where':_0x242383['options']?_0x242383[_0xad61('0x1a')][_0xad61('0x1b')]||null:null,'attributes':_0x242383[_0xad61('0x1a')]?_0x242383[_0xad61('0x1a')][_0xad61('0x1c')]||null:null,'limit':_0x242383[_0xad61('0x1a')]?_0x242383[_0xad61('0x1a')][_0xad61('0x1d')]||null:null,'include':_0x242383[_0xad61('0x1a')]?_0x242383['options'][_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x242383[_0xad61('0x1a')][_0xad61('0x1e')],function(_0x8d5e7f){return{'model':db[_0x8d5e7f[_0xad61('0x20')]],'as':_0x8d5e7f['as'],'attributes':_0x8d5e7f[_0xad61('0x1c')],'include':_0x8d5e7f['include']?_['map'](_0x8d5e7f[_0xad61('0x1e')],function(_0x36bbe4){return{'model':db[_0x36bbe4['model']],'as':_0x36bbe4['as'],'attributes':_0x36bbe4[_0xad61('0x1c')],'include':_0x36bbe4['include']?_['map'](_0x36bbe4[_0xad61('0x1e')],function(_0x59ed9a){return{'model':db[_0x59ed9a['model']],'as':_0x59ed9a['as'],'attributes':_0x59ed9a[_0xad61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad61('0xd')](function(_0x622578){logger[_0xad61('0xe')](_0xad61('0x18'),_0x242383);logger[_0xad61('0x10')]('GetServicenowAccount',_0x242383,JSON[_0xad61('0x21')](_0x622578));_0x31425e(_0x622578);})[_0xad61('0x17')](function(_0x144bb6){logger[_0xad61('0x12')](_0xad61('0x18'),_0x144bb6[_0xad61('0x15')],_0x242383);_0x5b5329(_0x41b4d9[_0xad61('0x12')](0x1f4,_0x144bb6['message']));});});};exports[_0xad61('0x22')]=function(_0x463f99){var _0x2a7627=this;return new Promise(function(_0x21f1bc,_0x3617ad){return db[_0xad61('0x23')][_0xad61('0x24')]({'raw':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x25')]===undefined?!![]:![]:!![],'where':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x1b')]||null:null,'attributes':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x1c')]||null:null,'include':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x463f99[_0xad61('0x1a')][_0xad61('0x1e')],function(_0x16bcc7){return{'model':db[_0x16bcc7['model']],'as':_0x16bcc7['as'],'attributes':_0x16bcc7[_0xad61('0x1c')],'include':_0x16bcc7[_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x16bcc7['include'],function(_0x5942f1){return{'model':db[_0x5942f1[_0xad61('0x20')]],'as':_0x5942f1['as'],'attributes':_0x5942f1[_0xad61('0x1c')],'include':_0x5942f1[_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x5942f1[_0xad61('0x1e')],function(_0x12fd86){return{'model':db[_0x12fd86[_0xad61('0x20')]],'as':_0x12fd86['as'],'attributes':_0x12fd86[_0xad61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad61('0xd')](function(_0x2cb680){logger[_0xad61('0xe')](_0xad61('0x22'),_0x463f99);logger[_0xad61('0x10')](_0xad61('0x22'),_0x463f99,JSON[_0xad61('0x21')](_0x2cb680));_0x21f1bc(_0x2cb680);})[_0xad61('0x17')](function(_0x3fb180){logger[_0xad61('0x12')](_0xad61('0x22'),_0x3fb180[_0xad61('0x15')],_0x463f99);_0x3617ad(_0x2a7627[_0xad61('0x12')](0x1f4,_0x3fb180[_0xad61('0x15')]));});});};