Built motion from commit (unavailable).|2.5.4
[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 _0x5502=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x314085,_0x4235c6){var _0x26190a=function(_0x2314a2){while(--_0x2314a2){_0x314085['push'](_0x314085['shift']());}};_0x26190a(++_0x4235c6);}(_0x5502,0x69));var _0x2550=function(_0x3862d9,_0x483475){_0x3862d9=_0x3862d9-0x0;var _0x46877c=_0x5502[_0x3862d9];return _0x46877c;};'use strict';var _=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var moment=require(_0x2550('0x2'));var BPromise=require(_0x2550('0x3'));var rs=require(_0x2550('0x4'));var fs=require('fs');var Redis=require(_0x2550('0x5'));var db=require(_0x2550('0x6'))['db'];var utils=require(_0x2550('0x7'));var logger=require(_0x2550('0x8'))(_0x2550('0x9'));var config=require(_0x2550('0xa'));var jayson=require(_0x2550('0xb'));var client=jayson[_0x2550('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fdfc5,_0x557e76,_0x51a38d){return new BPromise(function(_0x410692,_0x40ead6){return client['request'](_0x1fdfc5,_0x51a38d)[_0x2550('0xd')](function(_0x59ac75){logger[_0x2550('0xe')](_0x2550('0xf'),_0x557e76,_0x2550('0x10'));logger[_0x2550('0x11')](_0x2550('0x12'),_0x557e76,_0x2550('0x10'),JSON['stringify'](_0x59ac75));if(_0x59ac75[_0x2550('0x13')]){if(_0x59ac75[_0x2550('0x13')][_0x2550('0x14')]===0x1f4){logger[_0x2550('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x557e76,_0x59ac75[_0x2550('0x13')][_0x2550('0x15')]);return _0x40ead6(_0x59ac75['error'][_0x2550('0x15')]);}logger[_0x2550('0x13')](_0x2550('0xf'),_0x557e76,_0x59ac75[_0x2550('0x13')][_0x2550('0x15')]);return _0x410692(_0x59ac75[_0x2550('0x13')]['message']);}else{logger[_0x2550('0xe')](_0x2550('0xf'),_0x557e76,_0x2550('0x10'));_0x410692(_0x59ac75[_0x2550('0x16')][_0x2550('0x15')]);}})[_0x2550('0x17')](function(_0x4fcabb){logger[_0x2550('0x13')](_0x2550('0xf'),_0x557e76,_0x4fcabb);_0x40ead6(_0x4fcabb);});});}exports[_0x2550('0x18')]=function(_0x5c1bcb){var _0x98f713=this;return new Promise(function(_0x5451de,_0x50d45d){return db[_0x2550('0x19')]['findAll']({'raw':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')]['where']||null:null,'attributes':_0x5c1bcb['options']?_0x5c1bcb['options'][_0x2550('0x1c')]||null:null,'limit':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1d')]||null:null,'include':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x5c1bcb[_0x2550('0x1a')]['include'],function(_0x3dadc8){return{'model':db[_0x3dadc8[_0x2550('0x20')]],'as':_0x3dadc8['as'],'attributes':_0x3dadc8['attributes'],'include':_0x3dadc8[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x3dadc8['include'],function(_0x418828){return{'model':db[_0x418828[_0x2550('0x20')]],'as':_0x418828['as'],'attributes':_0x418828[_0x2550('0x1c')],'include':_0x418828[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x418828[_0x2550('0x1e')],function(_0x66ac37){return{'model':db[_0x66ac37[_0x2550('0x20')]],'as':_0x66ac37['as'],'attributes':_0x66ac37[_0x2550('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2550('0xd')](function(_0xe2744b){logger[_0x2550('0xe')](_0x2550('0x18'),_0x5c1bcb);logger['debug'](_0x2550('0x18'),_0x5c1bcb,JSON[_0x2550('0x21')](_0xe2744b));_0x5451de(_0xe2744b);})[_0x2550('0x17')](function(_0x38f07a){logger[_0x2550('0x13')](_0x2550('0x18'),_0x38f07a[_0x2550('0x15')],_0x5c1bcb);_0x50d45d(_0x98f713[_0x2550('0x13')](0x1f4,_0x38f07a[_0x2550('0x15')]));});});};exports[_0x2550('0x22')]=function(_0x222f62){var _0x3c6613=this;return new Promise(function(_0x561e7d,_0x3edad6){return db[_0x2550('0x19')][_0x2550('0x23')]({'raw':_0x222f62[_0x2550('0x1a')]?_0x222f62[_0x2550('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x222f62['options']?_0x222f62[_0x2550('0x1a')][_0x2550('0x24')]||null:null,'attributes':_0x222f62[_0x2550('0x1a')]?_0x222f62['options'][_0x2550('0x1c')]||null:null,'include':_0x222f62[_0x2550('0x1a')]?_0x222f62[_0x2550('0x1a')]['include']?_[_0x2550('0x1f')](_0x222f62[_0x2550('0x1a')][_0x2550('0x1e')],function(_0x5bce72){return{'model':db[_0x5bce72[_0x2550('0x20')]],'as':_0x5bce72['as'],'attributes':_0x5bce72['attributes'],'include':_0x5bce72[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x5bce72[_0x2550('0x1e')],function(_0x5dcf5a){return{'model':db[_0x5dcf5a[_0x2550('0x20')]],'as':_0x5dcf5a['as'],'attributes':_0x5dcf5a[_0x2550('0x1c')],'include':_0x5dcf5a['include']?_['map'](_0x5dcf5a[_0x2550('0x1e')],function(_0x40105b){return{'model':db[_0x40105b[_0x2550('0x20')]],'as':_0x40105b['as'],'attributes':_0x40105b[_0x2550('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2550('0xd')](function(_0x254456){logger[_0x2550('0xe')](_0x2550('0x22'),_0x222f62);logger[_0x2550('0x11')](_0x2550('0x22'),_0x222f62,JSON[_0x2550('0x21')](_0x254456));_0x561e7d(_0x254456);})[_0x2550('0x17')](function(_0x1f7e04){logger[_0x2550('0x13')](_0x2550('0x22'),_0x1f7e04['message'],_0x222f62);_0x3edad6(_0x3c6613['error'](0x1f4,_0x1f7e04[_0x2550('0x15')]));});});};