Built motion from commit b0a9a629.|2.6.33
[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 _0xc7ca=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','then','ShowDynamics365Account','catch','util','moment'];(function(_0x56a369,_0x447525){var _0x568420=function(_0x5ac520){while(--_0x5ac520){_0x56a369['push'](_0x56a369['shift']());}};_0x568420(++_0x447525);}(_0xc7ca,0x8e));var _0xac7c=function(_0x27dbbf,_0x24255a){_0x27dbbf=_0x27dbbf-0x0;var _0x19e1c0=_0xc7ca[_0x27dbbf];return _0x19e1c0;};'use strict';var _=require('lodash');var util=require(_0xac7c('0x0'));var moment=require(_0xac7c('0x1'));var BPromise=require(_0xac7c('0x2'));var rs=require(_0xac7c('0x3'));var fs=require('fs');var Redis=require(_0xac7c('0x4'));var db=require(_0xac7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7c('0x6'))(_0xac7c('0x7'));var config=require(_0xac7c('0x8'));var jayson=require(_0xac7c('0x9'));var client=jayson[_0xac7c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4270ea,_0x4d5455,_0x59238e){return new BPromise(function(_0xad238c,_0xab481b){return client[_0xac7c('0xb')](_0x4270ea,_0x59238e)['then'](function(_0x47ae52){logger[_0xac7c('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x4d5455,_0xac7c('0xd'));logger[_0xac7c('0xe')](_0xac7c('0xf'),_0x4d5455,_0xac7c('0xd'),JSON[_0xac7c('0x10')](_0x47ae52));if(_0x47ae52['error']){if(_0x47ae52[_0xac7c('0x11')][_0xac7c('0x12')]===0x1f4){logger[_0xac7c('0x11')](_0xac7c('0x13'),_0x4d5455,_0x47ae52[_0xac7c('0x11')][_0xac7c('0x14')]);return _0xab481b(_0x47ae52[_0xac7c('0x11')]['message']);}logger[_0xac7c('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x4d5455,_0x47ae52[_0xac7c('0x11')][_0xac7c('0x14')]);return _0xad238c(_0x47ae52[_0xac7c('0x11')][_0xac7c('0x14')]);}else{logger[_0xac7c('0xc')](_0xac7c('0x13'),_0x4d5455,_0xac7c('0xd'));_0xad238c(_0x47ae52[_0xac7c('0x15')][_0xac7c('0x14')]);}})['catch'](function(_0x568f37){logger[_0xac7c('0x11')](_0xac7c('0x13'),_0x4d5455,_0x568f37);_0xab481b(_0x568f37);});});}exports[_0xac7c('0x16')]=function(_0x393305){var _0x34620d=this;return new Promise(function(_0x4435e3,_0x42df37){return db[_0xac7c('0x17')][_0xac7c('0x18')]({'raw':_0x393305[_0xac7c('0x19')]?_0x393305['options'][_0xac7c('0x1a')]===undefined?!![]:![]:!![],'where':_0x393305[_0xac7c('0x19')]?_0x393305[_0xac7c('0x19')][_0xac7c('0x1b')]||null:null,'attributes':_0x393305['options']?_0x393305[_0xac7c('0x19')]['attributes']||null:null,'limit':_0x393305[_0xac7c('0x19')]?_0x393305['options'][_0xac7c('0x1c')]||null:null,'include':_0x393305[_0xac7c('0x19')]?_0x393305[_0xac7c('0x19')][_0xac7c('0x1d')]?_['map'](_0x393305['options'][_0xac7c('0x1d')],function(_0x500db1){return{'model':db[_0x500db1['model']],'as':_0x500db1['as'],'attributes':_0x500db1[_0xac7c('0x1e')],'include':_0x500db1[_0xac7c('0x1d')]?_[_0xac7c('0x1f')](_0x500db1[_0xac7c('0x1d')],function(_0xb8a082){return{'model':db[_0xb8a082[_0xac7c('0x20')]],'as':_0xb8a082['as'],'attributes':_0xb8a082['attributes'],'include':_0xb8a082['include']?_[_0xac7c('0x1f')](_0xb8a082[_0xac7c('0x1d')],function(_0xc4a83a){return{'model':db[_0xc4a83a[_0xac7c('0x20')]],'as':_0xc4a83a['as'],'attributes':_0xc4a83a[_0xac7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xac7c('0x21')](function(_0x1e614b){logger[_0xac7c('0xc')](_0xac7c('0x16'),_0x393305);logger[_0xac7c('0xe')](_0xac7c('0x16'),_0x393305,JSON[_0xac7c('0x10')](_0x1e614b));_0x4435e3(_0x1e614b);})['catch'](function(_0x4460f2){logger[_0xac7c('0x11')](_0xac7c('0x16'),_0x4460f2[_0xac7c('0x14')],_0x393305);_0x42df37(_0x34620d[_0xac7c('0x11')](0x1f4,_0x4460f2[_0xac7c('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x3759e2){var _0x230a7d=this;return new Promise(function(_0x5699b5,_0x410ad4){return db['Dynamics365Account']['find']({'raw':_0x3759e2[_0xac7c('0x19')]?_0x3759e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3759e2[_0xac7c('0x19')]?_0x3759e2['options'][_0xac7c('0x1b')]||null:null,'attributes':_0x3759e2['options']?_0x3759e2[_0xac7c('0x19')][_0xac7c('0x1e')]||null:null,'include':_0x3759e2[_0xac7c('0x19')]?_0x3759e2[_0xac7c('0x19')]['include']?_[_0xac7c('0x1f')](_0x3759e2[_0xac7c('0x19')][_0xac7c('0x1d')],function(_0x234bcb){return{'model':db[_0x234bcb[_0xac7c('0x20')]],'as':_0x234bcb['as'],'attributes':_0x234bcb[_0xac7c('0x1e')],'include':_0x234bcb[_0xac7c('0x1d')]?_[_0xac7c('0x1f')](_0x234bcb[_0xac7c('0x1d')],function(_0x34c924){return{'model':db[_0x34c924['model']],'as':_0x34c924['as'],'attributes':_0x34c924[_0xac7c('0x1e')],'include':_0x34c924['include']?_[_0xac7c('0x1f')](_0x34c924[_0xac7c('0x1d')],function(_0x3fb389){return{'model':db[_0x3fb389[_0xac7c('0x20')]],'as':_0x3fb389['as'],'attributes':_0x3fb389['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58b764){logger[_0xac7c('0xc')](_0xac7c('0x22'),_0x3759e2);logger['debug'](_0xac7c('0x22'),_0x3759e2,JSON[_0xac7c('0x10')](_0x58b764));_0x5699b5(_0x58b764);})[_0xac7c('0x23')](function(_0x4ef04d){logger[_0xac7c('0x11')](_0xac7c('0x22'),_0x4ef04d['message'],_0x3759e2);_0x410ad4(_0x230a7d[_0xac7c('0x11')](0x1f4,_0x4ef04d[_0xac7c('0x14')]));});});};