Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / intServicenowConfiguration / intServicenowConfiguration.controller.js
index 387a8e1..52d586a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00f2=['include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','ServicenowField','order','pick','filter','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll'];(function(_0x35fd47,_0x1e6e9b){var _0x7b52c2=function(_0x325c67){while(--_0x325c67){_0x35fd47['push'](_0x35fd47['shift']());}};_0x7b52c2(++_0x1e6e9b);}(_0x00f2,0xb1));var _0x200f=function(_0x171dc5,_0x254b48){_0x171dc5=_0x171dc5-0x0;var _0x512efc=_0x00f2[_0x171dc5];return _0x512efc;};'use strict';var emlformat=require(_0x200f('0x0'));var rimraf=require(_0x200f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x200f('0x2'));var rp=require(_0x200f('0x3'));var moment=require(_0x200f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x200f('0x5'));var util=require('util');var path=require(_0x200f('0x6'));var sox=require(_0x200f('0x7'));var csv=require(_0x200f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x200f('0x9'));var _=require(_0x200f('0xa'));var squel=require('squel');var crypto=require(_0x200f('0xb'));var jsforce=require(_0x200f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x200f('0x8'));var querystring=require(_0x200f('0xd'));var Papa=require(_0x200f('0xe'));var Redis=require('ioredis');var authService=require(_0x200f('0xf'));var qs=require(_0x200f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x200f('0x11'));var logger=require(_0x200f('0x12'))(_0x200f('0x13'));var utils=require(_0x200f('0x14'));var config=require(_0x200f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x200f('0x16'))['db'];function respondWithStatusCode(_0x582a10,_0x600b0f){_0x600b0f=_0x600b0f||0xcc;return function(_0x52010d){if(_0x52010d){return _0x582a10[_0x200f('0x17')](_0x600b0f);}return _0x582a10[_0x200f('0x18')](_0x600b0f)['end']();};}function respondWithResult(_0x395847,_0x8f3889){_0x8f3889=_0x8f3889||0xc8;return function(_0x5d5e7a){if(_0x5d5e7a){return _0x395847[_0x200f('0x18')](_0x8f3889)[_0x200f('0x19')](_0x5d5e7a);}};}function respondWithFilteredResult(_0x2c6f9d,_0x3dc147){return function(_0x3772bb){if(_0x3772bb){var _0x460f39=typeof _0x3dc147[_0x200f('0x1a')]===_0x200f('0x1b')&&typeof _0x3dc147[_0x200f('0x1c')]===_0x200f('0x1b');var _0x8dc336=_0x3772bb[_0x200f('0x1d')];var _0x4ce355=_0x460f39?0x0:_0x3dc147[_0x200f('0x1a')];var _0x16a112=_0x460f39?_0x3772bb[_0x200f('0x1d')]:_0x3dc147[_0x200f('0x1a')]+_0x3dc147['limit'];var _0x105ace;if(_0x16a112>=_0x8dc336){_0x16a112=_0x8dc336;_0x105ace=0xc8;}else{_0x105ace=0xce;}_0x2c6f9d[_0x200f('0x18')](_0x105ace);return _0x2c6f9d[_0x200f('0x1e')](_0x200f('0x1f'),_0x4ce355+'-'+_0x16a112+'/'+_0x8dc336)[_0x200f('0x19')](_0x3772bb);}return null;};}function patchUpdates(_0x257631){return function(_0x104441){try{jsonpatch[_0x200f('0x20')](_0x104441,_0x257631,!![]);}catch(_0x506405){return BPromise['reject'](_0x506405);}return _0x104441[_0x200f('0x21')]();};}function saveUpdates(_0x29427a,_0x3f0644){return function(_0x3cbf43){if(_0x3cbf43){return _0x3cbf43[_0x200f('0x22')](_0x29427a)[_0x200f('0x23')](function(_0xed552b){return _0xed552b;});}return null;};}function removeEntity(_0x20b4b7,_0x72e85f){return function(_0x435141){if(_0x435141){return _0x435141[_0x200f('0x24')]()[_0x200f('0x23')](function(){_0x20b4b7[_0x200f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b770,_0x433f54){return function(_0x1017f0){if(!_0x1017f0){_0x11b770[_0x200f('0x17')](0x194);}return _0x1017f0;};}function handleError(_0x488a30,_0x5d07ef){_0x5d07ef=_0x5d07ef||0x1f4;return function(_0x8660b2){logger['error'](_0x8660b2[_0x200f('0x25')]);if(_0x8660b2['name']){delete _0x8660b2[_0x200f('0x26')];}_0x488a30[_0x200f('0x18')](_0x5d07ef)[_0x200f('0x27')](_0x8660b2);};}exports[_0x200f('0x28')]=function(_0x242f6b,_0x572b8a){var _0xce3902={},_0x55d556={},_0x104d42={'count':0x0,'rows':[]};var _0x110620=_[_0x200f('0x29')](db[_0x200f('0x2a')][_0x200f('0x2b')],function(_0x5ec8f6){return{'name':_0x5ec8f6[_0x200f('0x2c')],'type':_0x5ec8f6[_0x200f('0x2d')][_0x200f('0x2e')]};});_0x55d556[_0x200f('0x2f')]=_[_0x200f('0x29')](_0x110620,_0x200f('0x26'));_0x55d556['query']=_[_0x200f('0x30')](_0x242f6b[_0x200f('0x31')]);_0x55d556[_0x200f('0x32')]=_['intersection'](_0x55d556[_0x200f('0x2f')],_0x55d556['query']);_0xce3902[_0x200f('0x33')]=_[_0x200f('0x34')](_0x55d556[_0x200f('0x2f')],qs[_0x200f('0x35')](_0x242f6b['query'][_0x200f('0x35')]));_0xce3902['attributes']=_0xce3902[_0x200f('0x33')][_0x200f('0x36')]?_0xce3902['attributes']:_0x55d556['model'];if(!_0x242f6b[_0x200f('0x31')][_0x200f('0x37')](_0x200f('0x38'))){_0xce3902['limit']=qs['limit'](_0x242f6b[_0x200f('0x31')][_0x200f('0x1c')]);_0xce3902[_0x200f('0x1a')]=qs[_0x200f('0x1a')](_0x242f6b[_0x200f('0x31')][_0x200f('0x1a')]);}_0xce3902['order']=qs[_0x200f('0x39')](_0x242f6b[_0x200f('0x31')]['sort']);_0xce3902[_0x200f('0x3a')]=qs[_0x200f('0x32')](_['pick'](_0x242f6b[_0x200f('0x31')],_0x55d556[_0x200f('0x32')]),_0x110620);if(_0x242f6b[_0x200f('0x31')]['filter']){_0xce3902[_0x200f('0x3a')]=_[_0x200f('0x3b')](_0xce3902[_0x200f('0x3a')],{'$or':_[_0x200f('0x29')](_0x110620,function(_0x33bd96){if(_0x33bd96['type']!==_0x200f('0x3c')){var _0x31c1e3={};_0x31c1e3[_0x33bd96['name']]={'$like':'%'+_0x242f6b[_0x200f('0x31')]['filter']+'%'};return _0x31c1e3;}})});}_0xce3902=_[_0x200f('0x3b')]({},_0xce3902,_0x242f6b[_0x200f('0x3d')]);var _0x5cab62={'where':_0xce3902['where']};return db[_0x200f('0x2a')][_0x200f('0x1d')](_0x5cab62)[_0x200f('0x23')](function(_0x15be8a){_0x104d42['count']=_0x15be8a;if(_0x242f6b['query'][_0x200f('0x3e')]){_0xce3902[_0x200f('0x3f')]=[{'all':!![]}];}return db[_0x200f('0x2a')][_0x200f('0x40')](_0xce3902);})[_0x200f('0x23')](function(_0x43f977){_0x104d42[_0x200f('0x41')]=_0x43f977;return _0x104d42;})[_0x200f('0x23')](respondWithFilteredResult(_0x572b8a,_0xce3902))['catch'](handleError(_0x572b8a,null));};exports[_0x200f('0x42')]=function(_0x3874e9,_0x2c652c){var _0x9043ca={'raw':![],'where':{'id':_0x3874e9[_0x200f('0x43')]['id']}},_0x1963e3={};_0x1963e3[_0x200f('0x2f')]=_[_0x200f('0x30')](db[_0x200f('0x2a')][_0x200f('0x2b')]);_0x1963e3['query']=_[_0x200f('0x30')](_0x3874e9[_0x200f('0x31')]);_0x1963e3[_0x200f('0x32')]=_['intersection'](_0x1963e3[_0x200f('0x2f')],_0x1963e3[_0x200f('0x31')]);_0x9043ca['attributes']=_[_0x200f('0x34')](_0x1963e3[_0x200f('0x2f')],qs[_0x200f('0x35')](_0x3874e9[_0x200f('0x31')][_0x200f('0x35')]));_0x9043ca[_0x200f('0x33')]=_0x9043ca[_0x200f('0x33')][_0x200f('0x36')]?_0x9043ca[_0x200f('0x33')]:_0x1963e3[_0x200f('0x2f')];if(_0x3874e9[_0x200f('0x31')][_0x200f('0x3e')]){_0x9043ca[_0x200f('0x3f')]=[{'all':!![]}];}_0x9043ca=_[_0x200f('0x3b')]({},_0x9043ca,_0x3874e9[_0x200f('0x3d')]);return db[_0x200f('0x2a')][_0x200f('0x44')](_0x9043ca)[_0x200f('0x23')](handleEntityNotFound(_0x2c652c,null))['then'](respondWithResult(_0x2c652c,null))[_0x200f('0x45')](handleError(_0x2c652c,null));};exports[_0x200f('0x46')]=function(_0x2d2e98,_0x40efb9){return db[_0x200f('0x2a')]['create'](_0x2d2e98[_0x200f('0x47')],{})['then'](respondWithResult(_0x40efb9,0xc9))['catch'](handleError(_0x40efb9,null));};exports[_0x200f('0x22')]=function(_0x519d10,_0x4eeba5){if(_0x519d10[_0x200f('0x47')]['id']){delete _0x519d10[_0x200f('0x47')]['id'];}return db['ServicenowConfiguration'][_0x200f('0x44')]({'where':{'id':_0x519d10[_0x200f('0x43')]['id']}})[_0x200f('0x23')](handleEntityNotFound(_0x4eeba5,null))[_0x200f('0x23')](saveUpdates(_0x519d10[_0x200f('0x47')],null))[_0x200f('0x23')](respondWithResult(_0x4eeba5,null))['catch'](handleError(_0x4eeba5,null));};exports[_0x200f('0x24')]=function(_0x285981,_0x1496e2){return db[_0x200f('0x2a')][_0x200f('0x44')]({'where':{'id':_0x285981[_0x200f('0x43')]['id']}})[_0x200f('0x23')](handleEntityNotFound(_0x1496e2,null))['then'](removeEntity(_0x1496e2,null))['catch'](handleError(_0x1496e2,null));};exports[_0x200f('0x48')]=function(_0x2f05f0,_0x1b5de7,_0x34f880){var _0x3ebc82={};var _0x4d3a64={};var _0x30207c;var _0x17d391;return db['ServicenowConfiguration'][_0x200f('0x49')]({'where':{'id':_0x2f05f0[_0x200f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b5de7,null))[_0x200f('0x23')](function(_0x5c0f4a){if(_0x5c0f4a){_0x30207c=_0x5c0f4a;_0x4d3a64[_0x200f('0x2f')]=_['keys'](db[_0x200f('0x4a')]['rawAttributes']);_0x4d3a64[_0x200f('0x31')]=_['keys'](_0x2f05f0['query']);_0x4d3a64['filters']=_[_0x200f('0x34')](_0x4d3a64[_0x200f('0x2f')],_0x4d3a64['query']);_0x3ebc82['attributes']=_[_0x200f('0x34')](_0x4d3a64['model'],qs['fields'](_0x2f05f0[_0x200f('0x31')][_0x200f('0x35')]));_0x3ebc82[_0x200f('0x33')]=_0x3ebc82['attributes']['length']?_0x3ebc82[_0x200f('0x33')]:_0x4d3a64['model'];_0x3ebc82[_0x200f('0x4b')]=qs[_0x200f('0x39')](_0x2f05f0['query']['sort']);_0x3ebc82[_0x200f('0x3a')]=qs[_0x200f('0x32')](_[_0x200f('0x4c')](_0x2f05f0['query'],_0x4d3a64['filters']));if(_0x2f05f0[_0x200f('0x31')]['filter']){_0x3ebc82['where']=_[_0x200f('0x3b')](_0x3ebc82[_0x200f('0x3a')],{'$or':_[_0x200f('0x29')](_0x3ebc82['attributes'],function(_0xb66acd){var _0xdf1824={};_0xdf1824[_0xb66acd]={'$like':'%'+_0x2f05f0[_0x200f('0x31')][_0x200f('0x4d')]+'%'};return _0xdf1824;})});}_0x3ebc82=_[_0x200f('0x3b')]({},_0x3ebc82,_0x2f05f0[_0x200f('0x3d')]);return _0x30207c[_0x200f('0x48')](_0x3ebc82);}})[_0x200f('0x23')](function(_0x435a5c){if(_0x435a5c){_0x17d391=_0x435a5c[_0x200f('0x36')];if(!_0x2f05f0[_0x200f('0x31')][_0x200f('0x37')](_0x200f('0x38'))){_0x3ebc82['limit']=qs[_0x200f('0x1c')](_0x2f05f0[_0x200f('0x31')]['limit']);_0x3ebc82[_0x200f('0x1a')]=qs[_0x200f('0x1a')](_0x2f05f0[_0x200f('0x31')][_0x200f('0x1a')]);}return _0x30207c[_0x200f('0x48')](_0x3ebc82);}})[_0x200f('0x23')](function(_0x35cd25){if(_0x35cd25){return _0x35cd25?{'count':_0x17d391,'rows':_0x35cd25}:null;}})[_0x200f('0x23')](respondWithResult(_0x1b5de7,null))[_0x200f('0x45')](handleError(_0x1b5de7,null));};exports[_0x200f('0x4e')]=function(_0x4595bb,_0x35f5b9,_0x3e4c92){var _0x4f6ace={};var _0x584b4d={};var _0x28e762;var _0x5114fa;return db[_0x200f('0x2a')][_0x200f('0x49')]({'where':{'id':_0x4595bb[_0x200f('0x43')]['id']}})[_0x200f('0x23')](handleEntityNotFound(_0x35f5b9,null))['then'](function(_0x2496ae){if(_0x2496ae){_0x28e762=_0x2496ae;_0x584b4d[_0x200f('0x2f')]=_['keys'](db['ServicenowField'][_0x200f('0x2b')]);_0x584b4d[_0x200f('0x31')]=_['keys'](_0x4595bb[_0x200f('0x31')]);_0x584b4d['filters']=_[_0x200f('0x34')](_0x584b4d[_0x200f('0x2f')],_0x584b4d[_0x200f('0x31')]);_0x4f6ace[_0x200f('0x33')]=_[_0x200f('0x34')](_0x584b4d['model'],qs[_0x200f('0x35')](_0x4595bb[_0x200f('0x31')][_0x200f('0x35')]));_0x4f6ace['attributes']=_0x4f6ace[_0x200f('0x33')][_0x200f('0x36')]?_0x4f6ace[_0x200f('0x33')]:_0x584b4d[_0x200f('0x2f')];_0x4f6ace[_0x200f('0x4b')]=qs[_0x200f('0x39')](_0x4595bb['query'][_0x200f('0x39')]);_0x4f6ace[_0x200f('0x3a')]=qs[_0x200f('0x32')](_[_0x200f('0x4c')](_0x4595bb[_0x200f('0x31')],_0x584b4d[_0x200f('0x32')]));if(_0x4595bb['query'][_0x200f('0x4d')]){_0x4f6ace['where']=_[_0x200f('0x3b')](_0x4f6ace[_0x200f('0x3a')],{'$or':_[_0x200f('0x29')](_0x4f6ace[_0x200f('0x33')],function(_0x260a59){var _0x2eb69b={};_0x2eb69b[_0x260a59]={'$like':'%'+_0x4595bb[_0x200f('0x31')][_0x200f('0x4d')]+'%'};return _0x2eb69b;})});}_0x4f6ace=_[_0x200f('0x3b')]({},_0x4f6ace,_0x4595bb[_0x200f('0x3d')]);return _0x28e762[_0x200f('0x4e')](_0x4f6ace);}})[_0x200f('0x23')](function(_0x4de931){if(_0x4de931){_0x5114fa=_0x4de931[_0x200f('0x36')];if(!_0x4595bb['query']['hasOwnProperty']('nolimit')){_0x4f6ace[_0x200f('0x1c')]=qs[_0x200f('0x1c')](_0x4595bb[_0x200f('0x31')][_0x200f('0x1c')]);_0x4f6ace[_0x200f('0x1a')]=qs['offset'](_0x4595bb[_0x200f('0x31')]['offset']);}return _0x28e762[_0x200f('0x4e')](_0x4f6ace);}})[_0x200f('0x23')](function(_0x405a4e){if(_0x405a4e){return _0x405a4e?{'count':_0x5114fa,'rows':_0x405a4e}:null;}})[_0x200f('0x23')](respondWithResult(_0x35f5b9,null))[_0x200f('0x45')](handleError(_0x35f5b9,null));};exports[_0x200f('0x4f')]=function(_0x346260,_0x461286,_0x5b698c){var _0xd18fad={};var _0x36f277={};var _0xfc6e17;var _0x5f144e;return db['ServicenowConfiguration'][_0x200f('0x49')]({'where':{'id':_0x346260[_0x200f('0x43')]['id']}})[_0x200f('0x23')](handleEntityNotFound(_0x461286,null))[_0x200f('0x23')](function(_0x2c3648){if(_0x2c3648){_0xfc6e17=_0x2c3648;_0x36f277[_0x200f('0x2f')]=_['keys'](db[_0x200f('0x4a')][_0x200f('0x2b')]);_0x36f277[_0x200f('0x31')]=_[_0x200f('0x30')](_0x346260[_0x200f('0x31')]);_0x36f277[_0x200f('0x32')]=_[_0x200f('0x34')](_0x36f277[_0x200f('0x2f')],_0x36f277[_0x200f('0x31')]);_0xd18fad[_0x200f('0x33')]=_[_0x200f('0x34')](_0x36f277[_0x200f('0x2f')],qs[_0x200f('0x35')](_0x346260[_0x200f('0x31')][_0x200f('0x35')]));_0xd18fad[_0x200f('0x33')]=_0xd18fad[_0x200f('0x33')][_0x200f('0x36')]?_0xd18fad[_0x200f('0x33')]:_0x36f277[_0x200f('0x2f')];_0xd18fad[_0x200f('0x4b')]=qs['sort'](_0x346260[_0x200f('0x31')][_0x200f('0x39')]);_0xd18fad[_0x200f('0x3a')]=qs[_0x200f('0x32')](_[_0x200f('0x4c')](_0x346260[_0x200f('0x31')],_0x36f277[_0x200f('0x32')]));if(_0x346260[_0x200f('0x31')]['filter']){_0xd18fad[_0x200f('0x3a')]=_['merge'](_0xd18fad['where'],{'$or':_[_0x200f('0x29')](_0xd18fad[_0x200f('0x33')],function(_0x45edc5){var _0x2dea69={};_0x2dea69[_0x45edc5]={'$like':'%'+_0x346260['query'][_0x200f('0x4d')]+'%'};return _0x2dea69;})});}_0xd18fad=_[_0x200f('0x3b')]({},_0xd18fad,_0x346260[_0x200f('0x3d')]);return _0xfc6e17[_0x200f('0x4f')](_0xd18fad);}})[_0x200f('0x23')](function(_0x775571){if(_0x775571){_0x5f144e=_0x775571[_0x200f('0x36')];if(!_0x346260[_0x200f('0x31')]['hasOwnProperty']('nolimit')){_0xd18fad['limit']=qs[_0x200f('0x1c')](_0x346260[_0x200f('0x31')]['limit']);_0xd18fad[_0x200f('0x1a')]=qs[_0x200f('0x1a')](_0x346260[_0x200f('0x31')][_0x200f('0x1a')]);}return _0xfc6e17[_0x200f('0x4f')](_0xd18fad);}})[_0x200f('0x23')](function(_0x2ee1a1){if(_0x2ee1a1){return _0x2ee1a1?{'count':_0x5f144e,'rows':_0x2ee1a1}:null;}})[_0x200f('0x23')](respondWithResult(_0x461286,null))[_0x200f('0x45')](handleError(_0x461286,null));};
\ No newline at end of file
+var _0x7a88=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','name','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ServicenowField','filter','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x41601d,_0x36ad17){var _0x1d5fb2=function(_0x27e1b6){while(--_0x27e1b6){_0x41601d['push'](_0x41601d['shift']());}};_0x1d5fb2(++_0x36ad17);}(_0x7a88,0xc4));var _0x87a8=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0x7a88[_0x57fda8];return _0x11c895;};'use strict';var emlformat=require(_0x87a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87a8('0x1'));var rp=require(_0x87a8('0x2'));var moment=require(_0x87a8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x87a8('0x4'));var util=require(_0x87a8('0x5'));var path=require(_0x87a8('0x6'));var sox=require(_0x87a8('0x7'));var csv=require(_0x87a8('0x8'));var ejs=require(_0x87a8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x87a8('0xa'));var crypto=require('crypto');var jsforce=require(_0x87a8('0xb'));var deskjs=require(_0x87a8('0xc'));var toCsv=require(_0x87a8('0x8'));var querystring=require('querystring');var Papa=require(_0x87a8('0xd'));var Redis=require(_0x87a8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x87a8('0xf'));var as=require(_0x87a8('0x10'));var hardwareService=require(_0x87a8('0x11'));var logger=require(_0x87a8('0x12'))(_0x87a8('0x13'));var utils=require(_0x87a8('0x14'));var config=require(_0x87a8('0x15'));var licenseUtil=require(_0x87a8('0x16'));var db=require(_0x87a8('0x17'))['db'];function respondWithStatusCode(_0xb75ef0,_0x1f6c97){_0x1f6c97=_0x1f6c97||0xcc;return function(_0xf2b6b1){if(_0xf2b6b1){return _0xb75ef0['sendStatus'](_0x1f6c97);}return _0xb75ef0['status'](_0x1f6c97)[_0x87a8('0x18')]();};}function respondWithResult(_0x59c81a,_0x33cc62){_0x33cc62=_0x33cc62||0xc8;return function(_0x132566){if(_0x132566){return _0x59c81a[_0x87a8('0x19')](_0x33cc62)[_0x87a8('0x1a')](_0x132566);}};}function respondWithFilteredResult(_0x4f71d2,_0x497746){return function(_0xa852bc){if(_0xa852bc){var _0x1285f2=typeof _0x497746['offset']===_0x87a8('0x1b')&&typeof _0x497746['limit']===_0x87a8('0x1b');var _0x4bcfdc=_0xa852bc['count'];var _0x27e25a=_0x1285f2?0x0:_0x497746[_0x87a8('0x1c')];var _0x8f29c3=_0x1285f2?_0xa852bc['count']:_0x497746[_0x87a8('0x1c')]+_0x497746['limit'];var _0x4a77b2;if(_0x8f29c3>=_0x4bcfdc){_0x8f29c3=_0x4bcfdc;_0x4a77b2=0xc8;}else{_0x4a77b2=0xce;}_0x4f71d2[_0x87a8('0x19')](_0x4a77b2);return _0x4f71d2[_0x87a8('0x1d')](_0x87a8('0x1e'),_0x27e25a+'-'+_0x8f29c3+'/'+_0x4bcfdc)[_0x87a8('0x1a')](_0xa852bc);}return null;};}function patchUpdates(_0x2580ac){return function(_0x1e95d6){try{jsonpatch['apply'](_0x1e95d6,_0x2580ac,!![]);}catch(_0x3a39c7){return BPromise[_0x87a8('0x1f')](_0x3a39c7);}return _0x1e95d6[_0x87a8('0x20')]();};}function saveUpdates(_0x28bab9,_0x5291d7){return function(_0x142a93){if(_0x142a93){return _0x142a93[_0x87a8('0x21')](_0x28bab9)[_0x87a8('0x22')](function(_0x5e04fa){return _0x5e04fa;});}return null;};}function removeEntity(_0x52d955,_0x1a6403){return function(_0x2b630e){if(_0x2b630e){return _0x2b630e[_0x87a8('0x23')]()['then'](function(){_0x52d955[_0x87a8('0x19')](0xcc)[_0x87a8('0x18')]();});}};}function handleEntityNotFound(_0x2ff512,_0x82b8cb){return function(_0x562ae6){if(!_0x562ae6){_0x2ff512[_0x87a8('0x24')](0x194);}return _0x562ae6;};}function handleError(_0x41d51a,_0x5e9e64){_0x5e9e64=_0x5e9e64||0x1f4;return function(_0x3948b3){logger[_0x87a8('0x25')](_0x3948b3[_0x87a8('0x26')]);if(_0x3948b3['name']){delete _0x3948b3['name'];}_0x41d51a[_0x87a8('0x19')](_0x5e9e64)[_0x87a8('0x27')](_0x3948b3);};}exports[_0x87a8('0x28')]=function(_0x16fc04,_0x4b0cec){var _0x361312={},_0x8418f1={},_0x561355={'count':0x0,'rows':[]};var _0x238986=_['map'](db[_0x87a8('0x29')][_0x87a8('0x2a')],function(_0x3daef1){return{'name':_0x3daef1[_0x87a8('0x2b')],'type':_0x3daef1['type'][_0x87a8('0x2c')]};});_0x8418f1[_0x87a8('0x2d')]=_[_0x87a8('0x2e')](_0x238986,'name');_0x8418f1[_0x87a8('0x2f')]=_[_0x87a8('0x30')](_0x16fc04[_0x87a8('0x2f')]);_0x8418f1[_0x87a8('0x31')]=_[_0x87a8('0x32')](_0x8418f1[_0x87a8('0x2d')],_0x8418f1['query']);_0x361312[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x8418f1[_0x87a8('0x2d')],qs[_0x87a8('0x34')](_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x34')]));_0x361312[_0x87a8('0x33')]=_0x361312[_0x87a8('0x33')][_0x87a8('0x35')]?_0x361312[_0x87a8('0x33')]:_0x8418f1[_0x87a8('0x2d')];if(!_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x36')](_0x87a8('0x37'))){_0x361312[_0x87a8('0x38')]=qs[_0x87a8('0x38')](_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x38')]);_0x361312[_0x87a8('0x1c')]=qs[_0x87a8('0x1c')](_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x1c')]);}_0x361312[_0x87a8('0x39')]=qs[_0x87a8('0x3a')](_0x16fc04[_0x87a8('0x2f')]['sort']);_0x361312[_0x87a8('0x3b')]=qs[_0x87a8('0x31')](_[_0x87a8('0x3c')](_0x16fc04[_0x87a8('0x2f')],_0x8418f1['filters']),_0x238986);if(_0x16fc04[_0x87a8('0x2f')]['filter']){_0x361312[_0x87a8('0x3b')]=_['merge'](_0x361312[_0x87a8('0x3b')],{'$or':_[_0x87a8('0x2e')](_0x238986,function(_0x398b5a){if(_0x398b5a[_0x87a8('0x3d')]!==_0x87a8('0x3e')){var _0x14cf97={};_0x14cf97[_0x398b5a[_0x87a8('0x3f')]]={'$like':'%'+_0x16fc04['query']['filter']+'%'};return _0x14cf97;}})});}_0x361312=_[_0x87a8('0x40')]({},_0x361312,_0x16fc04[_0x87a8('0x41')]);var _0x1d2ed5={'where':_0x361312[_0x87a8('0x3b')]};return db[_0x87a8('0x29')][_0x87a8('0x42')](_0x1d2ed5)[_0x87a8('0x22')](function(_0x39cdae){_0x561355[_0x87a8('0x42')]=_0x39cdae;if(_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x43')]){_0x361312[_0x87a8('0x44')]=[{'all':!![]}];}return db[_0x87a8('0x29')][_0x87a8('0x45')](_0x361312);})[_0x87a8('0x22')](function(_0x3f41bf){_0x561355[_0x87a8('0x46')]=_0x3f41bf;return _0x561355;})[_0x87a8('0x22')](respondWithFilteredResult(_0x4b0cec,_0x361312))[_0x87a8('0x47')](handleError(_0x4b0cec,null));};exports[_0x87a8('0x48')]=function(_0x3e5a6a,_0x1291c4){var _0x54b302={'raw':![],'where':{'id':_0x3e5a6a[_0x87a8('0x49')]['id']}},_0x26405f={};_0x26405f['model']=_[_0x87a8('0x30')](db[_0x87a8('0x29')][_0x87a8('0x2a')]);_0x26405f[_0x87a8('0x2f')]=_[_0x87a8('0x30')](_0x3e5a6a['query']);_0x26405f['filters']=_[_0x87a8('0x32')](_0x26405f[_0x87a8('0x2d')],_0x26405f['query']);_0x54b302['attributes']=_[_0x87a8('0x32')](_0x26405f['model'],qs['fields'](_0x3e5a6a[_0x87a8('0x2f')][_0x87a8('0x34')]));_0x54b302[_0x87a8('0x33')]=_0x54b302[_0x87a8('0x33')][_0x87a8('0x35')]?_0x54b302[_0x87a8('0x33')]:_0x26405f[_0x87a8('0x2d')];if(_0x3e5a6a[_0x87a8('0x2f')][_0x87a8('0x43')]){_0x54b302[_0x87a8('0x44')]=[{'all':!![]}];}_0x54b302=_[_0x87a8('0x40')]({},_0x54b302,_0x3e5a6a[_0x87a8('0x41')]);return db[_0x87a8('0x29')][_0x87a8('0x4a')](_0x54b302)[_0x87a8('0x22')](handleEntityNotFound(_0x1291c4,null))[_0x87a8('0x22')](respondWithResult(_0x1291c4,null))[_0x87a8('0x47')](handleError(_0x1291c4,null));};exports['create']=function(_0x597798,_0xcaa360){return db[_0x87a8('0x29')][_0x87a8('0x4b')](_0x597798[_0x87a8('0x4c')],{})[_0x87a8('0x22')](respondWithResult(_0xcaa360,0xc9))[_0x87a8('0x47')](handleError(_0xcaa360,null));};exports[_0x87a8('0x21')]=function(_0x22aa5b,_0x50b6a5){if(_0x22aa5b[_0x87a8('0x4c')]['id']){delete _0x22aa5b[_0x87a8('0x4c')]['id'];}return db[_0x87a8('0x29')][_0x87a8('0x4a')]({'where':{'id':_0x22aa5b['params']['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x50b6a5,null))['then'](saveUpdates(_0x22aa5b[_0x87a8('0x4c')],null))[_0x87a8('0x22')](respondWithResult(_0x50b6a5,null))[_0x87a8('0x47')](handleError(_0x50b6a5,null));};exports[_0x87a8('0x23')]=function(_0x2837fd,_0x38b67b){return db['ServicenowConfiguration']['find']({'where':{'id':_0x2837fd[_0x87a8('0x49')]['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x38b67b,null))[_0x87a8('0x22')](removeEntity(_0x38b67b,null))[_0x87a8('0x47')](handleError(_0x38b67b,null));};exports[_0x87a8('0x4d')]=function(_0x274d73,_0x2930f3,_0x3a22b0){var _0x533af3={};var _0x2c0c9c={};var _0x3fa996;var _0x15c2c1;return db[_0x87a8('0x29')][_0x87a8('0x4e')]({'where':{'id':_0x274d73['params']['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x2930f3,null))[_0x87a8('0x22')](function(_0xac4582){if(_0xac4582){_0x3fa996=_0xac4582;_0x2c0c9c[_0x87a8('0x2d')]=_['keys'](db[_0x87a8('0x4f')]['rawAttributes']);_0x2c0c9c[_0x87a8('0x2f')]=_[_0x87a8('0x30')](_0x274d73['query']);_0x2c0c9c[_0x87a8('0x31')]=_[_0x87a8('0x32')](_0x2c0c9c['model'],_0x2c0c9c[_0x87a8('0x2f')]);_0x533af3[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x2c0c9c['model'],qs[_0x87a8('0x34')](_0x274d73[_0x87a8('0x2f')][_0x87a8('0x34')]));_0x533af3['attributes']=_0x533af3[_0x87a8('0x33')][_0x87a8('0x35')]?_0x533af3[_0x87a8('0x33')]:_0x2c0c9c[_0x87a8('0x2d')];_0x533af3['order']=qs[_0x87a8('0x3a')](_0x274d73[_0x87a8('0x2f')][_0x87a8('0x3a')]);_0x533af3[_0x87a8('0x3b')]=qs[_0x87a8('0x31')](_[_0x87a8('0x3c')](_0x274d73[_0x87a8('0x2f')],_0x2c0c9c[_0x87a8('0x31')]));if(_0x274d73[_0x87a8('0x2f')][_0x87a8('0x50')]){_0x533af3[_0x87a8('0x3b')]=_[_0x87a8('0x40')](_0x533af3['where'],{'$or':_['map'](_0x533af3['attributes'],function(_0x378701){var _0xbc4fa5={};_0xbc4fa5[_0x378701]={'$like':'%'+_0x274d73[_0x87a8('0x2f')]['filter']+'%'};return _0xbc4fa5;})});}_0x533af3=_[_0x87a8('0x40')]({},_0x533af3,_0x274d73[_0x87a8('0x41')]);return _0x3fa996[_0x87a8('0x4d')](_0x533af3);}})[_0x87a8('0x22')](function(_0x242a7d){if(_0x242a7d){_0x15c2c1=_0x242a7d[_0x87a8('0x35')];if(!_0x274d73[_0x87a8('0x2f')][_0x87a8('0x36')](_0x87a8('0x37'))){_0x533af3['limit']=qs[_0x87a8('0x38')](_0x274d73[_0x87a8('0x2f')][_0x87a8('0x38')]);_0x533af3[_0x87a8('0x1c')]=qs[_0x87a8('0x1c')](_0x274d73[_0x87a8('0x2f')]['offset']);}return _0x3fa996[_0x87a8('0x4d')](_0x533af3);}})[_0x87a8('0x22')](function(_0x28bb90){if(_0x28bb90){return _0x28bb90?{'count':_0x15c2c1,'rows':_0x28bb90}:null;}})[_0x87a8('0x22')](respondWithResult(_0x2930f3,null))[_0x87a8('0x47')](handleError(_0x2930f3,null));};exports[_0x87a8('0x51')]=function(_0x46a8aa,_0x1d14e0,_0x19120a){var _0x5db455={};var _0x1c9e24={};var _0x2f1092;var _0x1e132f;return db[_0x87a8('0x29')][_0x87a8('0x4e')]({'where':{'id':_0x46a8aa[_0x87a8('0x49')]['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x1d14e0,null))['then'](function(_0x5cd673){if(_0x5cd673){_0x2f1092=_0x5cd673;_0x1c9e24['model']=_[_0x87a8('0x30')](db[_0x87a8('0x4f')]['rawAttributes']);_0x1c9e24['query']=_['keys'](_0x46a8aa[_0x87a8('0x2f')]);_0x1c9e24[_0x87a8('0x31')]=_[_0x87a8('0x32')](_0x1c9e24[_0x87a8('0x2d')],_0x1c9e24['query']);_0x5db455[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x1c9e24['model'],qs[_0x87a8('0x34')](_0x46a8aa[_0x87a8('0x2f')]['fields']));_0x5db455[_0x87a8('0x33')]=_0x5db455[_0x87a8('0x33')]['length']?_0x5db455[_0x87a8('0x33')]:_0x1c9e24[_0x87a8('0x2d')];_0x5db455['order']=qs[_0x87a8('0x3a')](_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x3a')]);_0x5db455[_0x87a8('0x3b')]=qs[_0x87a8('0x31')](_[_0x87a8('0x3c')](_0x46a8aa[_0x87a8('0x2f')],_0x1c9e24[_0x87a8('0x31')]));if(_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x50')]){_0x5db455[_0x87a8('0x3b')]=_[_0x87a8('0x40')](_0x5db455[_0x87a8('0x3b')],{'$or':_[_0x87a8('0x2e')](_0x5db455['attributes'],function(_0x395552){var _0x297873={};_0x297873[_0x395552]={'$like':'%'+_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x50')]+'%'};return _0x297873;})});}_0x5db455=_[_0x87a8('0x40')]({},_0x5db455,_0x46a8aa[_0x87a8('0x41')]);return _0x2f1092[_0x87a8('0x51')](_0x5db455);}})[_0x87a8('0x22')](function(_0x1d32a){if(_0x1d32a){_0x1e132f=_0x1d32a[_0x87a8('0x35')];if(!_0x46a8aa[_0x87a8('0x2f')]['hasOwnProperty'](_0x87a8('0x37'))){_0x5db455[_0x87a8('0x38')]=qs['limit'](_0x46a8aa['query'][_0x87a8('0x38')]);_0x5db455[_0x87a8('0x1c')]=qs['offset'](_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x1c')]);}return _0x2f1092[_0x87a8('0x51')](_0x5db455);}})[_0x87a8('0x22')](function(_0x1eebb9){if(_0x1eebb9){return _0x1eebb9?{'count':_0x1e132f,'rows':_0x1eebb9}:null;}})[_0x87a8('0x22')](respondWithResult(_0x1d14e0,null))['catch'](handleError(_0x1d14e0,null));};exports[_0x87a8('0x52')]=function(_0x1b2bcb,_0x54c95b,_0x13c51){var _0x2c5c77={};var _0x535571={};var _0x271ad1;var _0x26efa8;return db['ServicenowConfiguration'][_0x87a8('0x4e')]({'where':{'id':_0x1b2bcb['params']['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x54c95b,null))['then'](function(_0x2a3262){if(_0x2a3262){_0x271ad1=_0x2a3262;_0x535571[_0x87a8('0x2d')]=_['keys'](db[_0x87a8('0x4f')][_0x87a8('0x2a')]);_0x535571[_0x87a8('0x2f')]=_['keys'](_0x1b2bcb[_0x87a8('0x2f')]);_0x535571['filters']=_[_0x87a8('0x32')](_0x535571[_0x87a8('0x2d')],_0x535571[_0x87a8('0x2f')]);_0x2c5c77[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x535571[_0x87a8('0x2d')],qs['fields'](_0x1b2bcb[_0x87a8('0x2f')]['fields']));_0x2c5c77[_0x87a8('0x33')]=_0x2c5c77['attributes'][_0x87a8('0x35')]?_0x2c5c77['attributes']:_0x535571['model'];_0x2c5c77[_0x87a8('0x39')]=qs[_0x87a8('0x3a')](_0x1b2bcb['query'][_0x87a8('0x3a')]);_0x2c5c77[_0x87a8('0x3b')]=qs['filters'](_['pick'](_0x1b2bcb[_0x87a8('0x2f')],_0x535571[_0x87a8('0x31')]));if(_0x1b2bcb[_0x87a8('0x2f')]['filter']){_0x2c5c77[_0x87a8('0x3b')]=_['merge'](_0x2c5c77[_0x87a8('0x3b')],{'$or':_[_0x87a8('0x2e')](_0x2c5c77[_0x87a8('0x33')],function(_0x5d1ea6){var _0x196a47={};_0x196a47[_0x5d1ea6]={'$like':'%'+_0x1b2bcb[_0x87a8('0x2f')][_0x87a8('0x50')]+'%'};return _0x196a47;})});}_0x2c5c77=_[_0x87a8('0x40')]({},_0x2c5c77,_0x1b2bcb['options']);return _0x271ad1[_0x87a8('0x52')](_0x2c5c77);}})[_0x87a8('0x22')](function(_0x11976e){if(_0x11976e){_0x26efa8=_0x11976e['length'];if(!_0x1b2bcb[_0x87a8('0x2f')][_0x87a8('0x36')](_0x87a8('0x37'))){_0x2c5c77[_0x87a8('0x38')]=qs['limit'](_0x1b2bcb[_0x87a8('0x2f')][_0x87a8('0x38')]);_0x2c5c77[_0x87a8('0x1c')]=qs[_0x87a8('0x1c')](_0x1b2bcb[_0x87a8('0x2f')]['offset']);}return _0x271ad1[_0x87a8('0x52')](_0x2c5c77);}})[_0x87a8('0x22')](function(_0x292bef){if(_0x292bef){return _0x292bef?{'count':_0x26efa8,'rows':_0x292bef}:null;}})[_0x87a8('0x22')](respondWithResult(_0x54c95b,null))['catch'](handleError(_0x54c95b,null));};
\ No newline at end of file