Built motion from commit 43538d75.|2.5.35
[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 _0x85b8=['http','request','then','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x47f7ac,_0x51ef78){var _0x4f75b6=function(_0x501e2a){while(--_0x501e2a){_0x47f7ac['push'](_0x47f7ac['shift']());}};_0x4f75b6(++_0x51ef78);}(_0x85b8,0x9f));var _0x885b=function(_0x19fc44,_0x4bca56){_0x19fc44=_0x19fc44-0x0;var _0x3414ec=_0x85b8[_0x19fc44];return _0x3414ec;};'use strict';var _=require('lodash');var util=require(_0x885b('0x0'));var moment=require('moment');var BPromise=require(_0x885b('0x1'));var rs=require(_0x885b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x885b('0x3'));var logger=require(_0x885b('0x4'))(_0x885b('0x5'));var config=require(_0x885b('0x6'));var jayson=require(_0x885b('0x7'));var client=jayson[_0x885b('0x8')][_0x885b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38f7e6,_0x3c671c,_0x4b8df1){return new BPromise(function(_0x4c41df,_0x1eb36a){return client[_0x885b('0xa')](_0x38f7e6,_0x4b8df1)[_0x885b('0xb')](function(_0x31d001){logger[_0x885b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x3c671c,_0x885b('0xd'));logger[_0x885b('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3c671c,_0x885b('0xd'),JSON[_0x885b('0xf')](_0x31d001));if(_0x31d001['error']){if(_0x31d001[_0x885b('0x10')][_0x885b('0x11')]===0x1f4){logger[_0x885b('0x10')](_0x885b('0x12'),_0x3c671c,_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);return _0x1eb36a(_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);}logger['error'](_0x885b('0x12'),_0x3c671c,_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);return _0x4c41df(_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);}else{logger[_0x885b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x3c671c,'request\x20sent');_0x4c41df(_0x31d001['result'][_0x885b('0x13')]);}})[_0x885b('0x14')](function(_0x2ffbe4){logger[_0x885b('0x10')](_0x885b('0x12'),_0x3c671c,_0x2ffbe4);_0x1eb36a(_0x2ffbe4);});});}