d09c74f8f63df17db378f0085815d2cd6660cce7
[motion2.git] / server / api / cmCustomField / cmCustomField.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 _0xea79=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring'];(function(_0x3a0a7c,_0x4483b7){var _0x52a0a3=function(_0x31e253){while(--_0x31e253){_0x3a0a7c['push'](_0x3a0a7c['shift']());}};_0x52a0a3(++_0x4483b7);}(_0xea79,0x162));var _0x9ea7=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xea79[_0xb0de07];return _0x4633d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ea7('0x0'));var BPromise=require(_0x9ea7('0x1'));var rs=require(_0x9ea7('0x2'));var fs=require('fs');var Redis=require(_0x9ea7('0x3'));var db=require(_0x9ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea7('0x5'))(_0x9ea7('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ea7('0x7'));var client=jayson[_0x9ea7('0x8')][_0x9ea7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26462b,_0x9cd535,_0x527f09){return new BPromise(function(_0x1ef059,_0x9ae1f5){return client[_0x9ea7('0xa')](_0x26462b,_0x527f09)['then'](function(_0x3be103){logger[_0x9ea7('0xb')]('CmCustomField,\x20%s,\x20%s',_0x9cd535,_0x9ea7('0xc'));logger[_0x9ea7('0xd')](_0x9ea7('0xe'),_0x9cd535,_0x9ea7('0xc'),JSON[_0x9ea7('0xf')](_0x3be103));if(_0x3be103[_0x9ea7('0x10')]){if(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x11')]===0x1f4){logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);return _0x9ae1f5(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);}logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3be103[_0x9ea7('0x10')]['message']);return _0x1ef059(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);}else{logger[_0x9ea7('0xb')](_0x9ea7('0x12'),_0x9cd535,'request\x20sent');_0x1ef059(_0x3be103[_0x9ea7('0x14')][_0x9ea7('0x13')]);}})['catch'](function(_0x3e22fc){logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3e22fc);_0x9ae1f5(_0x3e22fc);});});}