Built motion from commit 25580385.|2.6.2
[motion2.git] / server / api / intDynamics365Account / intDynamics365Account.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 _0x097f=['client','http','request','then','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','limit','include','map','model','attributes','ShowDynamics365Account','find','where','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xf15be4,_0x2c2591){var _0x2b6849=function(_0x544282){while(--_0x544282){_0xf15be4['push'](_0xf15be4['shift']());}};_0x2b6849(++_0x2c2591);}(_0x097f,0x1b3));var _0xf097=function(_0x514816,_0x57c091){_0x514816=_0x514816-0x0;var _0x5c3a43=_0x097f[_0x514816];return _0x5c3a43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf097('0x0'));var BPromise=require(_0xf097('0x1'));var rs=require(_0xf097('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf097('0x4'))(_0xf097('0x5'));var config=require(_0xf097('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf097('0x7')][_0xf097('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26a342,_0x470c2e,_0x52420e){return new BPromise(function(_0x4b6252,_0x54b255){return client[_0xf097('0x9')](_0x26a342,_0x52420e)[_0xf097('0xa')](function(_0x4b776c){logger['info'](_0xf097('0xb'),_0x470c2e,'request\x20sent');logger[_0xf097('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x470c2e,_0xf097('0xd'),JSON[_0xf097('0xe')](_0x4b776c));if(_0x4b776c[_0xf097('0xf')]){if(_0x4b776c[_0xf097('0xf')][_0xf097('0x10')]===0x1f4){logger[_0xf097('0xf')](_0xf097('0xb'),_0x470c2e,_0x4b776c[_0xf097('0xf')]['message']);return _0x54b255(_0x4b776c['error'][_0xf097('0x11')]);}logger[_0xf097('0xf')](_0xf097('0xb'),_0x470c2e,_0x4b776c[_0xf097('0xf')][_0xf097('0x11')]);return _0x4b6252(_0x4b776c[_0xf097('0xf')][_0xf097('0x11')]);}else{logger[_0xf097('0x12')](_0xf097('0xb'),_0x470c2e,'request\x20sent');_0x4b6252(_0x4b776c[_0xf097('0x13')][_0xf097('0x11')]);}})[_0xf097('0x14')](function(_0x2e9fc2){logger[_0xf097('0xf')](_0xf097('0xb'),_0x470c2e,_0x2e9fc2);_0x54b255(_0x2e9fc2);});});}exports[_0xf097('0x15')]=function(_0x508a3a){var _0x803827=this;return new Promise(function(_0xe1f193,_0x473468){return db[_0xf097('0x16')][_0xf097('0x17')]({'raw':_0x508a3a[_0xf097('0x18')]?_0x508a3a[_0xf097('0x18')][_0xf097('0x19')]===undefined?!![]:![]:!![],'where':_0x508a3a[_0xf097('0x18')]?_0x508a3a[_0xf097('0x18')]['where']||null:null,'attributes':_0x508a3a['options']?_0x508a3a['options']['attributes']||null:null,'limit':_0x508a3a[_0xf097('0x18')]?_0x508a3a[_0xf097('0x18')][_0xf097('0x1a')]||null:null,'include':_0x508a3a['options']?_0x508a3a[_0xf097('0x18')][_0xf097('0x1b')]?_[_0xf097('0x1c')](_0x508a3a[_0xf097('0x18')]['include'],function(_0x1085fe){return{'model':db[_0x1085fe[_0xf097('0x1d')]],'as':_0x1085fe['as'],'attributes':_0x1085fe[_0xf097('0x1e')],'include':_0x1085fe[_0xf097('0x1b')]?_[_0xf097('0x1c')](_0x1085fe[_0xf097('0x1b')],function(_0x2bcd6e){return{'model':db[_0x2bcd6e[_0xf097('0x1d')]],'as':_0x2bcd6e['as'],'attributes':_0x2bcd6e[_0xf097('0x1e')],'include':_0x2bcd6e['include']?_['map'](_0x2bcd6e[_0xf097('0x1b')],function(_0x228536){return{'model':db[_0x228536['model']],'as':_0x228536['as'],'attributes':_0x228536['attributes']};}):[]};}):[]};}):[]:[]})[_0xf097('0xa')](function(_0x5e1b87){logger[_0xf097('0x12')](_0xf097('0x15'),_0x508a3a);logger[_0xf097('0xc')](_0xf097('0x15'),_0x508a3a,JSON[_0xf097('0xe')](_0x5e1b87));_0xe1f193(_0x5e1b87);})[_0xf097('0x14')](function(_0x213a77){logger['error'](_0xf097('0x15'),_0x213a77[_0xf097('0x11')],_0x508a3a);_0x473468(_0x803827[_0xf097('0xf')](0x1f4,_0x213a77[_0xf097('0x11')]));});});};exports[_0xf097('0x1f')]=function(_0x241374){var _0x527c11=this;return new Promise(function(_0x516f14,_0x415341){return db[_0xf097('0x16')][_0xf097('0x20')]({'raw':_0x241374[_0xf097('0x18')]?_0x241374[_0xf097('0x18')][_0xf097('0x19')]===undefined?!![]:![]:!![],'where':_0x241374[_0xf097('0x18')]?_0x241374[_0xf097('0x18')][_0xf097('0x21')]||null:null,'attributes':_0x241374[_0xf097('0x18')]?_0x241374['options']['attributes']||null:null,'include':_0x241374[_0xf097('0x18')]?_0x241374[_0xf097('0x18')]['include']?_[_0xf097('0x1c')](_0x241374[_0xf097('0x18')]['include'],function(_0x3e3ec9){return{'model':db[_0x3e3ec9['model']],'as':_0x3e3ec9['as'],'attributes':_0x3e3ec9[_0xf097('0x1e')],'include':_0x3e3ec9[_0xf097('0x1b')]?_[_0xf097('0x1c')](_0x3e3ec9['include'],function(_0x3b0f29){return{'model':db[_0x3b0f29['model']],'as':_0x3b0f29['as'],'attributes':_0x3b0f29[_0xf097('0x1e')],'include':_0x3b0f29['include']?_[_0xf097('0x1c')](_0x3b0f29[_0xf097('0x1b')],function(_0x134fc0){return{'model':db[_0x134fc0[_0xf097('0x1d')]],'as':_0x134fc0['as'],'attributes':_0x134fc0[_0xf097('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf097('0xa')](function(_0x50d63d){logger[_0xf097('0x12')]('ShowDynamics365Account',_0x241374);logger['debug'](_0xf097('0x1f'),_0x241374,JSON[_0xf097('0xe')](_0x50d63d));_0x516f14(_0x50d63d);})[_0xf097('0x14')](function(_0xeebc2){logger[_0xf097('0xf')](_0xf097('0x1f'),_0xeebc2[_0xf097('0x11')],_0x241374);_0x415341(_0x527c11[_0xf097('0xf')](0x1f4,_0xeebc2[_0xf097('0x11')]));});});};