Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / tag / tag.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 _0x4944=['code','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x7bea18,_0x8d243a){var _0x18dd83=function(_0x35f32c){while(--_0x35f32c){_0x7bea18['push'](_0x7bea18['shift']());}};_0x18dd83(++_0x8d243a);}(_0x4944,0x6d));var _0x4494=function(_0x34eed1,_0x494693){_0x34eed1=_0x34eed1-0x0;var _0x30c966=_0x4944[_0x34eed1];return _0x30c966;};'use strict';var _=require(_0x4494('0x0'));var util=require('util');var moment=require(_0x4494('0x1'));var BPromise=require(_0x4494('0x2'));var rs=require(_0x4494('0x3'));var fs=require('fs');var Redis=require(_0x4494('0x4'));var db=require(_0x4494('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4494('0x6'))('rpc');var config=require(_0x4494('0x7'));var jayson=require(_0x4494('0x8'));var client=jayson[_0x4494('0x9')][_0x4494('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a4911,_0x1a94d6,_0x55bb81){return new BPromise(function(_0x12ef8e,_0x21098c){return client['request'](_0x2a4911,_0x55bb81)[_0x4494('0xb')](function(_0xec1762){logger[_0x4494('0xc')](_0x4494('0xd'),_0x1a94d6,'request\x20sent');logger['debug'](_0x4494('0xe'),_0x1a94d6,_0x4494('0xf'),JSON[_0x4494('0x10')](_0xec1762));if(_0xec1762['error']){if(_0xec1762['error'][_0x4494('0x11')]===0x1f4){logger[_0x4494('0x12')](_0x4494('0xd'),_0x1a94d6,_0xec1762[_0x4494('0x12')][_0x4494('0x13')]);return _0x21098c(_0xec1762[_0x4494('0x12')]['message']);}logger[_0x4494('0x12')](_0x4494('0xd'),_0x1a94d6,_0xec1762[_0x4494('0x12')][_0x4494('0x13')]);return _0x12ef8e(_0xec1762[_0x4494('0x12')][_0x4494('0x13')]);}else{logger[_0x4494('0xc')]('Tag,\x20%s,\x20%s',_0x1a94d6,_0x4494('0xf'));_0x12ef8e(_0xec1762['result']['message']);}})[_0x4494('0x14')](function(_0x267d0b){logger['error']('Tag,\x20%s,\x20%s',_0x1a94d6,_0x267d0b);_0x21098c(_0x267d0b);});});}