Built motion from commit da617fac.|2.6.6
[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 _0xf40f=['stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','map','include','model','attributes','then','debug','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x5ebda9,_0x2badfe){var _0x3a99ee=function(_0x1354a5){while(--_0x1354a5){_0x5ebda9['push'](_0x5ebda9['shift']());}};_0x3a99ee(++_0x2badfe);}(_0xf40f,0x124));var _0xff40=function(_0x32672c,_0x13eca8){_0x32672c=_0x32672c-0x0;var _0x5e2a97=_0xf40f[_0x32672c];return _0x5e2a97;};'use strict';var _=require(_0xff40('0x0'));var util=require(_0xff40('0x1'));var moment=require(_0xff40('0x2'));var BPromise=require(_0xff40('0x3'));var rs=require(_0xff40('0x4'));var fs=require('fs');var Redis=require(_0xff40('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xff40('0x6'));var jayson=require(_0xff40('0x7'));var client=jayson[_0xff40('0x8')][_0xff40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4513a0,_0x1240f0,_0x30131a){return new BPromise(function(_0x19016c,_0x116598){return client[_0xff40('0xa')](_0x4513a0,_0x30131a)['then'](function(_0x643b9f){logger[_0xff40('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x1240f0,_0xff40('0xc'));logger['debug'](_0xff40('0xd'),_0x1240f0,'request\x20sent',JSON[_0xff40('0xe')](_0x643b9f));if(_0x643b9f[_0xff40('0xf')]){if(_0x643b9f[_0xff40('0xf')][_0xff40('0x10')]===0x1f4){logger['error'](_0xff40('0x11'),_0x1240f0,_0x643b9f[_0xff40('0xf')][_0xff40('0x12')]);return _0x116598(_0x643b9f['error']['message']);}logger[_0xff40('0xf')](_0xff40('0x11'),_0x1240f0,_0x643b9f[_0xff40('0xf')][_0xff40('0x12')]);return _0x19016c(_0x643b9f[_0xff40('0xf')][_0xff40('0x12')]);}else{logger[_0xff40('0xb')](_0xff40('0x11'),_0x1240f0,_0xff40('0xc'));_0x19016c(_0x643b9f['result'][_0xff40('0x12')]);}})[_0xff40('0x13')](function(_0x27ae2c){logger[_0xff40('0xf')](_0xff40('0x11'),_0x1240f0,_0x27ae2c);_0x116598(_0x27ae2c);});});}exports[_0xff40('0x14')]=function(_0x4f3098){var _0x37c119=this;return new Promise(function(_0xcd0ada,_0x2654d5){return db[_0xff40('0x15')][_0xff40('0x16')]({'raw':_0x4f3098[_0xff40('0x17')]?_0x4f3098[_0xff40('0x17')][_0xff40('0x18')]===undefined?!![]:![]:!![],'where':_0x4f3098[_0xff40('0x17')]?_0x4f3098[_0xff40('0x17')][_0xff40('0x19')]||null:null,'attributes':_0x4f3098['options']?_0x4f3098[_0xff40('0x17')]['attributes']||null:null,'limit':_0x4f3098[_0xff40('0x17')]?_0x4f3098['options']['limit']||null:null,'include':_0x4f3098[_0xff40('0x17')]?_0x4f3098[_0xff40('0x17')]['include']?_[_0xff40('0x1a')](_0x4f3098[_0xff40('0x17')][_0xff40('0x1b')],function(_0x17dccd){return{'model':db[_0x17dccd[_0xff40('0x1c')]],'as':_0x17dccd['as'],'attributes':_0x17dccd[_0xff40('0x1d')],'include':_0x17dccd['include']?_['map'](_0x17dccd['include'],function(_0x151902){return{'model':db[_0x151902['model']],'as':_0x151902['as'],'attributes':_0x151902['attributes'],'include':_0x151902['include']?_[_0xff40('0x1a')](_0x151902[_0xff40('0x1b')],function(_0xfad76a){return{'model':db[_0xfad76a[_0xff40('0x1c')]],'as':_0xfad76a['as'],'attributes':_0xfad76a['attributes']};}):[]};}):[]};}):[]:[]})[_0xff40('0x1e')](function(_0x3a3726){logger[_0xff40('0xb')](_0xff40('0x14'),_0x4f3098);logger[_0xff40('0x1f')]('GetDynamics365Account',_0x4f3098,JSON[_0xff40('0xe')](_0x3a3726));_0xcd0ada(_0x3a3726);})[_0xff40('0x13')](function(_0x37df6c){logger[_0xff40('0xf')]('GetDynamics365Account',_0x37df6c[_0xff40('0x12')],_0x4f3098);_0x2654d5(_0x37c119[_0xff40('0xf')](0x1f4,_0x37df6c['message']));});});};exports[_0xff40('0x20')]=function(_0x103c56){var _0x4372bc=this;return new Promise(function(_0xb8ad7c,_0x3aba3e){return db['Dynamics365Account'][_0xff40('0x21')]({'raw':_0x103c56[_0xff40('0x17')]?_0x103c56[_0xff40('0x17')][_0xff40('0x18')]===undefined?!![]:![]:!![],'where':_0x103c56['options']?_0x103c56[_0xff40('0x17')][_0xff40('0x19')]||null:null,'attributes':_0x103c56[_0xff40('0x17')]?_0x103c56[_0xff40('0x17')][_0xff40('0x1d')]||null:null,'include':_0x103c56[_0xff40('0x17')]?_0x103c56[_0xff40('0x17')][_0xff40('0x1b')]?_[_0xff40('0x1a')](_0x103c56['options'][_0xff40('0x1b')],function(_0x3918c9){return{'model':db[_0x3918c9[_0xff40('0x1c')]],'as':_0x3918c9['as'],'attributes':_0x3918c9[_0xff40('0x1d')],'include':_0x3918c9['include']?_[_0xff40('0x1a')](_0x3918c9[_0xff40('0x1b')],function(_0x132ae0){return{'model':db[_0x132ae0[_0xff40('0x1c')]],'as':_0x132ae0['as'],'attributes':_0x132ae0['attributes'],'include':_0x132ae0[_0xff40('0x1b')]?_[_0xff40('0x1a')](_0x132ae0[_0xff40('0x1b')],function(_0x1ee7e8){return{'model':db[_0x1ee7e8[_0xff40('0x1c')]],'as':_0x1ee7e8['as'],'attributes':_0x1ee7e8[_0xff40('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff40('0x1e')](function(_0x568675){logger[_0xff40('0xb')](_0xff40('0x20'),_0x103c56);logger['debug'](_0xff40('0x20'),_0x103c56,JSON[_0xff40('0xe')](_0x568675));_0xb8ad7c(_0x568675);})[_0xff40('0x13')](function(_0x2b0700){logger[_0xff40('0xf')](_0xff40('0x20'),_0x2b0700[_0xff40('0x12')],_0x103c56);_0x3aba3e(_0x4372bc[_0xff40('0xf')](0x1f4,_0x2b0700['message']));});});};