0093f7940859694b660caec04047234c31e218bd
[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 _0x012a=['rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x335b74,_0x276918){var _0x1e709e=function(_0x13c162){while(--_0x13c162){_0x335b74['push'](_0x335b74['shift']());}};_0x1e709e(++_0x276918);}(_0x012a,0xd1));var _0xa012=function(_0x175c13,_0x21224d){_0x175c13=_0x175c13-0x0;var _0x4876a6=_0x012a[_0x175c13];return _0x4876a6;};'use strict';var _=require('lodash');var util=require(_0xa012('0x0'));var moment=require('moment');var BPromise=require(_0xa012('0x1'));var rs=require(_0xa012('0x2'));var fs=require('fs');var Redis=require(_0xa012('0x3'));var db=require(_0xa012('0x4'))['db'];var utils=require(_0xa012('0x5'));var logger=require(_0xa012('0x6'))(_0xa012('0x7'));var config=require(_0xa012('0x8'));var jayson=require(_0xa012('0x9'));var client=jayson[_0xa012('0xa')][_0xa012('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c097,_0x3a957d,_0x4d4b0e){return new BPromise(function(_0x17d52a,_0x37d6ad){return client['request'](_0x44c097,_0x4d4b0e)[_0xa012('0xc')](function(_0x3d9838){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3a957d,_0xa012('0xd'));logger['debug'](_0xa012('0xe'),_0x3a957d,_0xa012('0xd'),JSON[_0xa012('0xf')](_0x3d9838));if(_0x3d9838[_0xa012('0x10')]){if(_0x3d9838[_0xa012('0x10')][_0xa012('0x11')]===0x1f4){logger['error'](_0xa012('0x12'),_0x3a957d,_0x3d9838['error'][_0xa012('0x13')]);return _0x37d6ad(_0x3d9838[_0xa012('0x10')][_0xa012('0x13')]);}logger[_0xa012('0x10')](_0xa012('0x12'),_0x3a957d,_0x3d9838['error']['message']);return _0x17d52a(_0x3d9838[_0xa012('0x10')][_0xa012('0x13')]);}else{logger[_0xa012('0x14')](_0xa012('0x12'),_0x3a957d,_0xa012('0xd'));_0x17d52a(_0x3d9838['result'][_0xa012('0x13')]);}})[_0xa012('0x15')](function(_0x497874){logger[_0xa012('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x3a957d,_0x497874);_0x37d6ad(_0x497874);});});}exports[_0xa012('0x16')]=function(_0x40be02){var _0x37238b=this;return new Promise(function(_0x5b0355,_0xca41e){return db[_0xa012('0x17')][_0xa012('0x18')]({'raw':_0x40be02[_0xa012('0x19')]?_0x40be02[_0xa012('0x19')][_0xa012('0x1a')]===undefined?!![]:![]:!![],'where':_0x40be02[_0xa012('0x19')]?_0x40be02[_0xa012('0x19')][_0xa012('0x1b')]||null:null,'attributes':_0x40be02[_0xa012('0x19')]?_0x40be02['options'][_0xa012('0x1c')]||null:null,'limit':_0x40be02[_0xa012('0x19')]?_0x40be02['options'][_0xa012('0x1d')]||null:null,'include':_0x40be02['options']?_0x40be02[_0xa012('0x19')][_0xa012('0x1e')]?_['map'](_0x40be02['options'][_0xa012('0x1e')],function(_0x588ed6){return{'model':db[_0x588ed6[_0xa012('0x1f')]],'as':_0x588ed6['as'],'attributes':_0x588ed6[_0xa012('0x1c')],'include':_0x588ed6['include']?_[_0xa012('0x20')](_0x588ed6['include'],function(_0x1958a0){return{'model':db[_0x1958a0[_0xa012('0x1f')]],'as':_0x1958a0['as'],'attributes':_0x1958a0[_0xa012('0x1c')],'include':_0x1958a0['include']?_[_0xa012('0x20')](_0x1958a0['include'],function(_0x3f0a0f){return{'model':db[_0x3f0a0f[_0xa012('0x1f')]],'as':_0x3f0a0f['as'],'attributes':_0x3f0a0f[_0xa012('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa012('0xc')](function(_0x14cf3f){logger[_0xa012('0x14')](_0xa012('0x16'),_0x40be02);logger['debug'](_0xa012('0x16'),_0x40be02,JSON[_0xa012('0xf')](_0x14cf3f));_0x5b0355(_0x14cf3f);})[_0xa012('0x15')](function(_0x18da3b){logger[_0xa012('0x10')]('GetServicenowAccount',_0x18da3b[_0xa012('0x13')],_0x40be02);_0xca41e(_0x37238b[_0xa012('0x10')](0x1f4,_0x18da3b[_0xa012('0x13')]));});});};exports[_0xa012('0x21')]=function(_0x5ee673){var _0x94f0b=this;return new Promise(function(_0x392704,_0x48cbe7){return db[_0xa012('0x17')][_0xa012('0x22')]({'raw':_0x5ee673[_0xa012('0x19')]?_0x5ee673[_0xa012('0x19')][_0xa012('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ee673[_0xa012('0x19')]?_0x5ee673['options']['where']||null:null,'attributes':_0x5ee673['options']?_0x5ee673[_0xa012('0x19')][_0xa012('0x1c')]||null:null,'include':_0x5ee673[_0xa012('0x19')]?_0x5ee673[_0xa012('0x19')][_0xa012('0x1e')]?_[_0xa012('0x20')](_0x5ee673[_0xa012('0x19')][_0xa012('0x1e')],function(_0x2f2903){return{'model':db[_0x2f2903[_0xa012('0x1f')]],'as':_0x2f2903['as'],'attributes':_0x2f2903['attributes'],'include':_0x2f2903[_0xa012('0x1e')]?_[_0xa012('0x20')](_0x2f2903[_0xa012('0x1e')],function(_0x1f9d59){return{'model':db[_0x1f9d59[_0xa012('0x1f')]],'as':_0x1f9d59['as'],'attributes':_0x1f9d59[_0xa012('0x1c')],'include':_0x1f9d59[_0xa012('0x1e')]?_[_0xa012('0x20')](_0x1f9d59[_0xa012('0x1e')],function(_0x107e02){return{'model':db[_0x107e02[_0xa012('0x1f')]],'as':_0x107e02['as'],'attributes':_0x107e02[_0xa012('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa012('0xc')](function(_0x1ae005){logger[_0xa012('0x14')](_0xa012('0x21'),_0x5ee673);logger[_0xa012('0x23')](_0xa012('0x21'),_0x5ee673,JSON[_0xa012('0xf')](_0x1ae005));_0x392704(_0x1ae005);})[_0xa012('0x15')](function(_0xe12fc3){logger[_0xa012('0x10')]('ShowServicenowAccount',_0xe12fc3['message'],_0x5ee673);_0x48cbe7(_0x94f0b[_0xa012('0x10')](0x1f4,_0xe12fc3['message']));});});};