67f01ad9920617708e58054a37f6bd94f8eaa9fa
[motion2.git] / server / api / condition / condition.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 _0x203e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x203e,0x96));var _0xe203=function(_0x561c8e,_0x43bc60){_0x561c8e=_0x561c8e-0x0;var _0x345697=_0x203e[_0x561c8e];return _0x345697;};'use strict';var _=require(_0xe203('0x0'));var util=require(_0xe203('0x1'));var moment=require(_0xe203('0x2'));var BPromise=require(_0xe203('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe203('0x4'));var db=require(_0xe203('0x5'))['db'];var utils=require(_0xe203('0x6'));var logger=require(_0xe203('0x7'))('rpc');var config=require(_0xe203('0x8'));var jayson=require(_0xe203('0x9'));var client=jayson[_0xe203('0xa')][_0xe203('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd68c6b,_0xa8f92d,_0x149fa3){return new BPromise(function(_0x155918,_0x4f8597){return client[_0xe203('0xc')](_0xd68c6b,_0x149fa3)[_0xe203('0xd')](function(_0x11fdc9){logger[_0xe203('0xe')](_0xe203('0xf'),_0xa8f92d,_0xe203('0x10'));logger[_0xe203('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0xa8f92d,_0xe203('0x10'),JSON[_0xe203('0x12')](_0x11fdc9));if(_0x11fdc9[_0xe203('0x13')]){if(_0x11fdc9[_0xe203('0x13')]['code']===0x1f4){logger[_0xe203('0x13')](_0xe203('0xf'),_0xa8f92d,_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);return _0x4f8597(_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);}logger[_0xe203('0x13')](_0xe203('0xf'),_0xa8f92d,_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);return _0x155918(_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);}else{logger[_0xe203('0xe')](_0xe203('0xf'),_0xa8f92d,_0xe203('0x10'));_0x155918(_0x11fdc9['result'][_0xe203('0x14')]);}})[_0xe203('0x15')](function(_0x4f69ed){logger['error'](_0xe203('0xf'),_0xa8f92d,_0x4f69ed);_0x4f8597(_0x4f69ed);});});}