dae38c8598a60be4d4075dfb55d837db1a4f174d
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.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 _0xc16a=['jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','then','catch','ShowServicenowAccount','find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x476b61,_0x28400f){var _0x8afab7=function(_0x3e3393){while(--_0x3e3393){_0x476b61['push'](_0x476b61['shift']());}};_0x8afab7(++_0x28400f);}(_0xc16a,0x14c));var _0xac16=function(_0x424689,_0x3a4791){_0x424689=_0x424689-0x0;var _0x55099d=_0xc16a[_0x424689];return _0x55099d;};'use strict';var _=require(_0xac16('0x0'));var util=require(_0xac16('0x1'));var moment=require(_0xac16('0x2'));var BPromise=require(_0xac16('0x3'));var rs=require(_0xac16('0x4'));var fs=require('fs');var Redis=require(_0xac16('0x5'));var db=require(_0xac16('0x6'))['db'];var utils=require(_0xac16('0x7'));var logger=require(_0xac16('0x8'))('rpc');var config=require(_0xac16('0x9'));var jayson=require(_0xac16('0xa'));var client=jayson[_0xac16('0xb')][_0xac16('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85ce55,_0x589f28,_0x50d53c){return new BPromise(function(_0x32dc18,_0x2f4013){return client[_0xac16('0xd')](_0x85ce55,_0x50d53c)['then'](function(_0x1e720b){logger[_0xac16('0xe')](_0xac16('0xf'),_0x589f28,'request\x20sent');logger[_0xac16('0x10')](_0xac16('0x11'),_0x589f28,'request\x20sent',JSON[_0xac16('0x12')](_0x1e720b));if(_0x1e720b[_0xac16('0x13')]){if(_0x1e720b['error'][_0xac16('0x14')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x589f28,_0x1e720b[_0xac16('0x13')][_0xac16('0x15')]);return _0x2f4013(_0x1e720b['error'][_0xac16('0x15')]);}logger['error'](_0xac16('0xf'),_0x589f28,_0x1e720b[_0xac16('0x13')][_0xac16('0x15')]);return _0x32dc18(_0x1e720b[_0xac16('0x13')][_0xac16('0x15')]);}else{logger[_0xac16('0xe')](_0xac16('0xf'),_0x589f28,_0xac16('0x16'));_0x32dc18(_0x1e720b[_0xac16('0x17')][_0xac16('0x15')]);}})['catch'](function(_0x3d7148){logger[_0xac16('0x13')](_0xac16('0xf'),_0x589f28,_0x3d7148);_0x2f4013(_0x3d7148);});});}exports[_0xac16('0x18')]=function(_0x56c413){var _0x927057=this;return new Promise(function(_0x1e05c2,_0x6099a3){return db[_0xac16('0x19')]['findAll']({'raw':_0x56c413['options']?_0x56c413[_0xac16('0x1a')][_0xac16('0x1b')]===undefined?!![]:![]:!![],'where':_0x56c413[_0xac16('0x1a')]?_0x56c413[_0xac16('0x1a')][_0xac16('0x1c')]||null:null,'attributes':_0x56c413['options']?_0x56c413['options'][_0xac16('0x1d')]||null:null,'limit':_0x56c413[_0xac16('0x1a')]?_0x56c413[_0xac16('0x1a')][_0xac16('0x1e')]||null:null,'include':_0x56c413[_0xac16('0x1a')]?_0x56c413[_0xac16('0x1a')][_0xac16('0x1f')]?_[_0xac16('0x20')](_0x56c413[_0xac16('0x1a')][_0xac16('0x1f')],function(_0x8762a7){return{'model':db[_0x8762a7['model']],'as':_0x8762a7['as'],'attributes':_0x8762a7[_0xac16('0x1d')],'include':_0x8762a7[_0xac16('0x1f')]?_[_0xac16('0x20')](_0x8762a7[_0xac16('0x1f')],function(_0x3422dd){return{'model':db[_0x3422dd['model']],'as':_0x3422dd['as'],'attributes':_0x3422dd[_0xac16('0x1d')],'include':_0x3422dd[_0xac16('0x1f')]?_[_0xac16('0x20')](_0x3422dd[_0xac16('0x1f')],function(_0xf57794){return{'model':db[_0xf57794['model']],'as':_0xf57794['as'],'attributes':_0xf57794[_0xac16('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac16('0x21')](function(_0x212b3a){logger['info'](_0xac16('0x18'),_0x56c413);logger[_0xac16('0x10')](_0xac16('0x18'),_0x56c413,JSON[_0xac16('0x12')](_0x212b3a));_0x1e05c2(_0x212b3a);})[_0xac16('0x22')](function(_0x53a23c){logger[_0xac16('0x13')](_0xac16('0x18'),_0x53a23c[_0xac16('0x15')],_0x56c413);_0x6099a3(_0x927057[_0xac16('0x13')](0x1f4,_0x53a23c[_0xac16('0x15')]));});});};exports[_0xac16('0x23')]=function(_0x584327){var _0x596355=this;return new Promise(function(_0x1cf430,_0x36251f){return db[_0xac16('0x19')][_0xac16('0x24')]({'raw':_0x584327[_0xac16('0x1a')]?_0x584327['options'][_0xac16('0x1b')]===undefined?!![]:![]:!![],'where':_0x584327[_0xac16('0x1a')]?_0x584327[_0xac16('0x1a')][_0xac16('0x1c')]||null:null,'attributes':_0x584327[_0xac16('0x1a')]?_0x584327[_0xac16('0x1a')]['attributes']||null:null,'include':_0x584327[_0xac16('0x1a')]?_0x584327['options'][_0xac16('0x1f')]?_[_0xac16('0x20')](_0x584327['options']['include'],function(_0x519542){return{'model':db[_0x519542['model']],'as':_0x519542['as'],'attributes':_0x519542[_0xac16('0x1d')],'include':_0x519542['include']?_[_0xac16('0x20')](_0x519542[_0xac16('0x1f')],function(_0x3941fd){return{'model':db[_0x3941fd['model']],'as':_0x3941fd['as'],'attributes':_0x3941fd[_0xac16('0x1d')],'include':_0x3941fd[_0xac16('0x1f')]?_['map'](_0x3941fd['include'],function(_0x16890f){return{'model':db[_0x16890f[_0xac16('0x25')]],'as':_0x16890f['as'],'attributes':_0x16890f[_0xac16('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4daa8b){logger[_0xac16('0xe')]('ShowServicenowAccount',_0x584327);logger[_0xac16('0x10')](_0xac16('0x23'),_0x584327,JSON[_0xac16('0x12')](_0x4daa8b));_0x1cf430(_0x4daa8b);})['catch'](function(_0x2b7dbb){logger[_0xac16('0x13')](_0xac16('0x23'),_0x2b7dbb[_0xac16('0x15')],_0x584327);_0x36251f(_0x596355['error'](0x1f4,_0x2b7dbb[_0xac16('0x15')]));});});};