3952d4b0d12d1fc6ef997274fa8e2e208cb324ba
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x77a4=['jayson/promise','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x77a4,0xaa));var _0x477a=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x77a4[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0x477a('0x0'));var util=require(_0x477a('0x1'));var moment=require(_0x477a('0x2'));var BPromise=require(_0x477a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477a('0x4'));var db=require(_0x477a('0x5'))['db'];var utils=require(_0x477a('0x6'));var logger=require(_0x477a('0x7'))(_0x477a('0x8'));var config=require(_0x477a('0x9'));var jayson=require(_0x477a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x379d9f,_0x3521a5,_0x21eb73){return new BPromise(function(_0x4d824b,_0x4d23e6){return client['request'](_0x379d9f,_0x21eb73)['then'](function(_0xb2c59c){logger[_0x477a('0xb')](_0x477a('0xc'),_0x3521a5,_0x477a('0xd'));logger[_0x477a('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3521a5,_0x477a('0xd'),JSON[_0x477a('0xf')](_0xb2c59c));if(_0xb2c59c['error']){if(_0xb2c59c[_0x477a('0x10')]['code']===0x1f4){logger[_0x477a('0x10')]('DeskField,\x20%s,\x20%s',_0x3521a5,_0xb2c59c[_0x477a('0x10')]['message']);return _0x4d23e6(_0xb2c59c[_0x477a('0x10')][_0x477a('0x11')]);}logger[_0x477a('0x10')](_0x477a('0xc'),_0x3521a5,_0xb2c59c[_0x477a('0x10')][_0x477a('0x11')]);return _0x4d824b(_0xb2c59c[_0x477a('0x10')]['message']);}else{logger[_0x477a('0xb')](_0x477a('0xc'),_0x3521a5,_0x477a('0xd'));_0x4d824b(_0xb2c59c[_0x477a('0x12')][_0x477a('0x11')]);}})[_0x477a('0x13')](function(_0x2c5592){logger[_0x477a('0x10')]('DeskField,\x20%s,\x20%s',_0x3521a5,_0x2c5592);_0x4d23e6(_0x2c5592);});});}