scimgateway 4.4.5 → 4.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1147,6 +1147,11 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1147
1147
 
1148
1148
  ## Change log
1149
1149
 
1150
+ ### v4.4.6
1151
+
1152
+ [Improved]
1153
+
1154
+ - Some PUT logic redesign. More granularity on mulitvalues, instead of including all elements, now only those that differ are sent to modifyUser.
1150
1155
 
1151
1156
  ### v4.4.5
1152
1157
 
@@ -10,4 +10,4 @@
10
10
  // for details see: https://elshaug.xyz/docs/scim-stream
11
11
  //
12
12
  // ================================================================
13
- 'use strict';const a0_0x1411a2=a0_0x1aec;(function(_0x1bc9a9,_0xce0693){const _0x47297a=a0_0x1aec,_0x5e16f5=_0x1bc9a9();while(!![]){try{const _0x242b43=-parseInt(_0x47297a(0x18e))/0x1+parseInt(_0x47297a(0x1bb))/0x2*(-parseInt(_0x47297a(0x175))/0x3)+parseInt(_0x47297a(0xfe))/0x4*(parseInt(_0x47297a(0x111))/0x5)+parseInt(_0x47297a(0x1a6))/0x6*(-parseInt(_0x47297a(0x11d))/0x7)+parseInt(_0x47297a(0x103))/0x8*(-parseInt(_0x47297a(0x1bd))/0x9)+-parseInt(_0x47297a(0x11a))/0xa+parseInt(_0x47297a(0x19a))/0xb*(parseInt(_0x47297a(0x16f))/0xc);if(_0x242b43===_0xce0693)break;else _0x5e16f5['push'](_0x5e16f5['shift']());}catch(_0x51457b){_0x5e16f5['push'](_0x5e16f5['shift']());}}}(a0_0x4879,0x43510));const nats=require(a0_0x1411a2(0xf6)),ascii127=require(a0_0x1411a2(0x16a)),fs=require('fs'),utils=require(a0_0x1411a2(0x102)),path=require(a0_0x1411a2(0x160)),crypto=require(a0_0x1411a2(0x14d));function a0_0x1aec(_0x18737c,_0x26d716){const _0x48799c=a0_0x4879();return a0_0x1aec=function(_0x1aecd9,_0x47fd71){_0x1aecd9=_0x1aecd9-0xf5;let _0x22d9ab=_0x48799c[_0x1aecd9];return _0x22d9ab;},a0_0x1aec(_0x18737c,_0x26d716);}module['exports'][a0_0x1411a2(0x130)]=function(_0xf1bb45,_0x3002aa,_0xb77f27,_0x53b3e4){const _0xbbad37=a0_0x1411a2,_0x1b5b69=_0xf1bb45,_0x51a98e=_0x3002aa,_0xf45a2b=_0xb77f27,_0xbf5b23=_0x53b3e4;if(!_0x51a98e['certificate']||!_0x51a98e[_0xbbad37(0x106)]['ca']){_0x1b5b69[_0xbbad37(0x170)][_0xbbad37(0x188)](_0x1b5b69[_0xbbad37(0x10f)]+'['+_0x1b5b69[_0xbbad37(0x18f)]+']\x20subscriber\x20error:\x20missing\x20certificate\x20configuration');return;}if(!_0x51a98e[_0xbbad37(0x1b3)]){_0x1b5b69[_0xbbad37(0x170)][_0xbbad37(0x188)](_0x1b5b69[_0xbbad37(0x10f)]+'['+_0x1b5b69['pluginName']+_0xbbad37(0x198));return;}let _0x47b2c2='';for(let _0x1ef563=0x0;_0x1ef563<_0x1b5b69[_0xbbad37(0x170)][_0xbbad37(0x19b)][_0xbbad37(0x172)];_0x1ef563++){if(_0x1b5b69['logger'][_0xbbad37(0x19b)][_0x1ef563][_0xbbad37(0x120)]===_0xbbad37(0x11c)){_0x47b2c2=_0x1b5b69[_0xbbad37(0x170)][_0xbbad37(0x19b)][_0x1ef563][_0xbbad37(0x112)];break;}}const _0x1a761a=''+(_0x47b2c2==='debug'?'\x0a':''),_0x1922d9={};try{_0x1922d9['ca']=[fs[_0xbbad37(0x109)](_0x1b5b69['configDir']+'/certs/'+_0x51a98e[_0xbbad37(0x106)]['ca'])];}catch(_0x2c6aa){_0x1b5b69[_0xbbad37(0x170)][_0xbbad37(0x188)](_0x1b5b69[_0xbbad37(0x10f)]+'['+_0x1b5b69['pluginName']+_0xbbad37(0x122)+_0x2c6aa[_0xbbad37(0x1b4)]);return;}const _0x11e7f3={},_0x143446=new TextEncoder()[_0xbbad37(0x124)](_0x51a98e[_0xbbad37(0xf6)][_0xbbad37(0x14f)]),_0x411b6a=_0x51a98e[_0xbbad37(0xf6)]['jwt'];_0x11e7f3[_0xbbad37(0x15d)]=nats['jwtAuthenticator'](_0x411b6a,_0x143446),_0x11e7f3[_0xbbad37(0x19f)]=_0x51a98e['baseUrls'],_0x11e7f3['tls']=_0x1922d9,_0x11e7f3[_0xbbad37(0x140)]=![],_0x11e7f3['reconnect']=!![],_0x11e7f3['reconnectTimeWait']=0x3e8*0xa,_0x11e7f3['maxReconnectAttempts']=-0x1,_0x11e7f3[_0xbbad37(0x195)]=0x2*0x3c*0x3e8,_0x11e7f3[_0xbbad37(0x1a7)]=0x5,_0x11e7f3[_0xbbad37(0x132)]=![];let _0x496767;this[_0xbbad37(0x1be)]=async()=>{const _0x20e8d4=_0xbbad37;try{_0x496767=await nats['connect'](_0x11e7f3);}catch(_0x61f63){_0x1b5b69['logger'][_0x20e8d4(0x188)](_0x1b5b69[_0x20e8d4(0x10f)]+'['+_0x1b5b69['pluginName']+_0x20e8d4(0x15a)+_0xf45a2b+']['+_0xbf5b23+']\x20connect\x20error:\x20'+_0x61f63['message']+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0x11e7f3[_0x20e8d4(0x140)]=!![];try{_0x496767=await nats[_0x20e8d4(0x1be)](_0x11e7f3);}catch(_0x174020){_0x1b5b69[_0x20e8d4(0x170)]['error'](_0x1b5b69[_0x20e8d4(0x10f)]+'['+_0x1b5b69[_0x20e8d4(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+_0x20e8d4(0x1b8)+_0x174020['message']);return;}}_0x1b5b69['logger'][_0x20e8d4(0x135)](_0x1b5b69[_0x20e8d4(0x10f)]+'['+_0x1b5b69[_0x20e8d4(0x18f)]+_0x20e8d4(0x15a)+_0xf45a2b+']['+_0xbf5b23+']\x20connected\x20'+(_0x11e7f3[_0x20e8d4(0x158)]['ca']?_0x20e8d4(0x158):'')+'\x20'+_0x496767[_0x20e8d4(0x157)]()),_0x496767[_0x20e8d4(0x150)]()[_0x20e8d4(0x17a)](_0x5be8ff=>{const _0x4bff47=_0x20e8d4;_0x5be8ff&&_0x1b5b69[_0x4bff47(0x170)][_0x4bff47(0x188)](_0x1b5b69[_0x4bff47(0x10f)]+'['+_0x1b5b69[_0x4bff47(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+']\x20closed\x20with\x20error:\x20'+_0x5be8ff[_0x4bff47(0x1b4)]);});},this[_0xbbad37(0xfc)]=async()=>{const _0x714335=_0xbbad37;if(!_0xbf5b23||!_0x51a98e[_0x714335(0x10a)]||!_0x51a98e[_0x714335(0x106)]||!_0x51a98e[_0x714335(0x106)]['ca']||!_0x51a98e['nats']||!_0x51a98e[_0x714335(0xf6)]['tenant']||!_0x51a98e[_0x714335(0xf6)][_0x714335(0x14f)]||!_0x51a98e[_0x714335(0xf6)][_0x714335(0x199)]){_0x1b5b69[_0x714335(0x170)]['error'](_0x1b5b69[_0x714335(0x10f)]+'['+_0x1b5b69[_0x714335(0x18f)]+_0x714335(0x15a)+_0xf45a2b+']['+_0xbf5b23+_0x714335(0x13d));return;}if(_0xbf5b23[_0x714335(0xff)]('.')['length']<0x2){_0x1b5b69[_0x714335(0x170)][_0x714335(0x188)](_0x1b5b69[_0x714335(0x10f)]+'['+_0x1b5b69['pluginName']+_0x714335(0x15a)+_0xf45a2b+']['+_0xbf5b23+']\x20error:\x20subject\x20'+_0xbf5b23+_0x714335(0x1ab));return;}if(_0xbf5b23['includes'](',')){_0x1b5b69['logger'][_0x714335(0x188)](_0x1b5b69[_0x714335(0x10f)]+'['+_0x1b5b69[_0x714335(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+_0x714335(0x16e));return;}if(!_0x496767){_0x1b5b69[_0x714335(0x170)]['error'](_0x1b5b69[_0x714335(0x10f)]+'['+_0x1b5b69[_0x714335(0x18f)]+_0x714335(0x15a)+_0xf45a2b+']['+_0xbf5b23+_0x714335(0x178));return;}const _0x1fa7c2=async(_0x457fc8,_0x12019c)=>{const _0x205e55=_0x714335;try{_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x135)](_0x457fc8+_0x205e55(0x15b)+_0x12019c);let _0x588661;try{if(_0x51a98e[_0x205e55(0x146)]&&Array[_0x205e55(0x141)](_0x51a98e[_0x205e55(0x146)]))for(let _0x4994d6=0x0;_0x4994d6<_0x51a98e[_0x205e55(0x146)][_0x205e55(0x172)];_0x4994d6++){const _0x2f33ea=_0x51a98e['replaceDomains'][_0x4994d6];if(!_0x2f33ea[_0x205e55(0x171)]||!_0x2f33ea[_0x205e55(0x171)]['includes']('.')||!_0x2f33ea['to']||!_0x2f33ea['to'][_0x205e55(0x163)]('.'))continue;const _0x5682cc=new RegExp('@'+_0x2f33ea[_0x205e55(0x171)]+'\x22','gi');_0x12019c=_0x12019c[_0x205e55(0x1a5)](_0x5682cc,'@'+_0x2f33ea['to']+'\x22');}_0x588661=JSON[_0x205e55(0x177)](_0x12019c);}catch(_0x93f9ce){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](_0x457fc8+'\x20message\x20json\x20parsing\x20error:\x20'+_0x93f9ce[_0x205e55(0x1b4)]+_0x205e55(0x133)+_0x12019c),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}const _0x5772f2=_0x588661['user'];if(!_0x5772f2){_0x1b5b69[_0x205e55(0x170)]['error'](_0x457fc8+_0x205e55(0x194)+JSON[_0x205e55(0x13b)](_0x588661)),_0x1b5b69['logger'][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}if(!_0x5772f2['userName']){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](_0x457fc8+'\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20'+JSON[_0x205e55(0x13b)](_0x588661)),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}delete _0x5772f2[_0x205e55(0x180)];let _0x5ddf26;_0x5772f2['id']&&(_0x5ddf26=_0x5772f2['id'],delete _0x5772f2['id']);let _0x18ded9;_0x5772f2[_0x205e55(0x1ae)]&&(_0x18ded9=utils[_0x205e55(0x12f)](_0x5772f2['onCreate']),delete _0x5772f2[_0x205e55(0x1ae)]);await _0x2b8d29(_0x5772f2);const _0x579f72=_0x5772f2['userName'];let _0x20103e,_0x5991c3;try{_0x20103e=await _0x41c8ed(_0x205e55(0xf5),_0x579f72);}catch(_0x5ca322){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](_0x457fc8+_0x205e55(0x155)+_0x5ca322[_0x205e55(0x1b4)]),_0x1b5b69['logger'][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}if(!_0x51a98e[_0x205e55(0x154)]){let _0x1aec3c=![];if(_0x588661[_0x205e55(0x145)]&&Array[_0x205e55(0x141)](_0x588661[_0x205e55(0x145)]))for(let _0x36717d=0x0;_0x36717d<_0x588661[_0x205e55(0x145)][_0x205e55(0x172)];_0x36717d++){const _0x5bc6ff=_0x588661['Operations'][_0x36717d];_0x5bc6ff[_0x205e55(0x160)]['startsWith'](_0x205e55(0x1b7))&&(_0x5bc6ff[_0x205e55(0x160)]='groups',Array[_0x205e55(0x141)](_0x5bc6ff[_0x205e55(0x173)])?(_0x5bc6ff['value'][0x0]['id']=_0x5bc6ff[_0x205e55(0x173)][0x0][_0x205e55(0x173)],_0x5bc6ff[_0x205e55(0x173)][0x0]['display']=_0x5bc6ff[_0x205e55(0x173)][0x0][_0x205e55(0xfd)]+_0x205e55(0x128)+_0x5bc6ff[_0x205e55(0x173)][0x0]['value'],delete _0x5bc6ff[_0x205e55(0x173)][0x0]['value'],delete _0x5bc6ff[_0x205e55(0x173)][0x0][_0x205e55(0xfd)]):_0x5bc6ff[_0x205e55(0x173)]=[{'id':_0x5bc6ff[_0x205e55(0x173)],'display':_0x5bc6ff['value']}],delete _0x5bc6ff['typeId'],_0x1aec3c=!![]);}if(_0x5772f2[_0x205e55(0x1b7)]&&Array[_0x205e55(0x141)](_0x5772f2['roles'])&&_0x5772f2['roles'][_0x205e55(0x172)]>0x0){if(!_0x5772f2[_0x205e55(0x12a)])_0x5772f2[_0x205e55(0x12a)]=[];if(!Array[_0x205e55(0x141)](_0x5772f2[_0x205e55(0x12a)]))_0x5772f2[_0x205e55(0x12a)]=[];for(let _0x274880=0x0;_0x274880<_0x5772f2['roles'][_0x205e55(0x172)];_0x274880++){const _0x219f94={},_0x4adb66=_0x5772f2[_0x205e55(0x1b7)][_0x274880];_0x219f94[_0x205e55(0x173)]=_0x4adb66[_0x205e55(0x173)],_0x219f94['display']=_0x4adb66[_0x205e55(0xfd)]+_0x205e55(0x128)+_0x4adb66[_0x205e55(0x1a4)],_0x5772f2[_0x205e55(0x12a)]['push'](_0x219f94);}delete _0x5772f2[_0x205e55(0x1b7)],_0x1aec3c=!![];}if(_0x1aec3c)_0x1b5b69[_0x205e55(0x170)]['debug'](_0x457fc8+_0x205e55(0x151)+JSON[_0x205e55(0x13b)](_0x588661));}if(_0x51a98e[_0x205e55(0x182)]&&_0x588661['activityOperation']==='modifyUser'){if(_0x5772f2[_0x205e55(0x12a)]&&Array[_0x205e55(0x141)](_0x5772f2[_0x205e55(0x12a)])&&_0x5772f2[_0x205e55(0x12a)]['length']===0x0){if(_0x5772f2[_0x205e55(0x1b7)]&&Array[_0x205e55(0x141)](_0x5772f2[_0x205e55(0x1b7)])&&_0x5772f2[_0x205e55(0x1b7)]['length']===0x0){if(_0x588661['Operations']&&Array[_0x205e55(0x141)](_0x588661[_0x205e55(0x145)])&&_0x588661[_0x205e55(0x145)][_0x205e55(0x172)]>0x0)for(let _0x460646=0x0;_0x460646<_0x588661['Operations'][_0x205e55(0x172)];_0x460646++){const _0xd6cbdf=_0x588661[_0x205e55(0x145)][_0x460646];if(_0xd6cbdf['op']==='remove'){if(_0xd6cbdf[_0x205e55(0x160)]){if(_0xd6cbdf['path']['startsWith'](_0x205e55(0x1b7))&&_0xd6cbdf['typeId'])_0x588661[_0x205e55(0x159)]='deleteUser';else _0xd6cbdf[_0x205e55(0x160)]===_0x205e55(0x12a)&&(_0x588661[_0x205e55(0x159)]='deleteUser');}}}}}}if(!_0x20103e){if(_0x588661[_0x205e55(0x159)]==='deleteUser'){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x168)+_0x579f72+_0x205e55(0x10b)),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+'\x20done'+_0x1a761a);return;}if(_0x51a98e[_0x205e55(0x11b)]&&_0x51a98e[_0x205e55(0x11b)]===!![]){_0x1b5b69['logger'][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x1aa)+_0x579f72+_0x205e55(0x167)),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}if(Object[_0x205e55(0x14b)][_0x205e55(0x166)][_0x205e55(0x190)](_0x5772f2,_0x205e55(0x1af))){if(typeof _0x5772f2['active']===_0x205e55(0x1b6)){const _0x322d28=_0x5772f2['active']['toLowerCase']();if(_0x322d28===_0x205e55(0x1a8))_0x5772f2['active']=!![];else{if(_0x322d28===_0x205e55(0x100))_0x5772f2[_0x205e55(0x1af)]=![];}}if(_0x5772f2[_0x205e55(0x1af)]===![]){_0x1b5b69[_0x205e55(0x170)]['debug'](_0x457fc8+_0x205e55(0x1aa)+_0x579f72+_0x205e55(0x1b5)),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}}_0x1b5b69[_0x205e55(0x170)]['debug'](_0x457fc8+_0x205e55(0x187)+_0x579f72);const _0x3fbea2=utils[_0x205e55(0x12f)](_0x5772f2);try{delete _0x3fbea2[_0x205e55(0x12a)];!_0x3fbea2[_0x205e55(0x193)]&&_0x51a98e[_0x205e55(0x131)]&&_0x51a98e[_0x205e55(0x131)]===!![]&&(_0x3fbea2[_0x205e55(0x193)]=utils[_0x205e55(0x191)](0xf));if(_0x18ded9||_0x5ddf26){if(_0x18ded9)for(const _0x50f86f in _0x18ded9){_0x3fbea2[_0x50f86f]=_0x18ded9[_0x50f86f];}if(_0x5ddf26)_0x3fbea2['id']=_0x5ddf26;await _0x2b8d29(_0x3fbea2);}await _0x1b5b69[_0x205e55(0x119)](_0xf45a2b,_0x3fbea2),_0x5772f2['groups']&&Array['isArray'](_0x5772f2[_0x205e55(0x12a)])&&_0x5772f2[_0x205e55(0x12a)][_0x205e55(0x172)]>0x0&&(_0x5991c3=await _0x41c8ed(_0x205e55(0xf5),_0x579f72));}catch(_0xe72b1){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](_0x457fc8+_0x205e55(0x123)+JSON[_0x205e55(0x13b)](_0x3fbea2)+_0x205e55(0xf9)+_0xe72b1[_0x205e55(0x1b4)]+'}'),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+'\x20done'+_0x1a761a);return;}}if(_0x20103e||_0x5991c3){if(_0x588661[_0x205e55(0x159)]==='deleteUser'){if(_0x51a98e[_0x205e55(0x11b)]&&_0x51a98e[_0x205e55(0x11b)]===!![]){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x13c)+_0x20103e+'\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true'),_0x1b5b69[_0x205e55(0x170)]['debug'](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}_0x1b5b69['logger']['debug'](_0x457fc8+_0x205e55(0x13c)+_0x20103e);try{await _0x1b5b69[_0x205e55(0x161)](_0xf45a2b,_0x20103e);}catch(_0x7d9e68){_0x1b5b69[_0x205e55(0x170)]['error'](_0x457fc8+'\x20Delete\x20User\x20id='+_0x20103e+_0x205e55(0xf9)+_0x7d9e68['message']+'}'),_0x1b5b69[_0x205e55(0x170)]['debug'](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}}else{if(_0x5991c3)_0x20103e=_0x5991c3;_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x13a)+_0x20103e);const _0x33ba9f={};_0x33ba9f[_0x205e55(0x179)]=()=>{},_0x33ba9f[_0x205e55(0x183)]={},_0x33ba9f['params'][_0x205e55(0x189)]=_0xf45a2b,_0x33ba9f[_0x205e55(0x183)]['id']=_0x20103e,_0x33ba9f['request']={},_0x33ba9f[_0x205e55(0x197)][_0x205e55(0x152)]=_0xf45a2b?'/'+_0xf45a2b+_0x205e55(0x136)+_0x20103e:_0x205e55(0x136)+_0x20103e,_0x33ba9f[_0x205e55(0x197)][_0x205e55(0x17f)]=_0x5772f2;try{await _0x1b5b69['replaceUsrGrp'](_0x33ba9f);}catch(_0x740dc8){_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](_0x457fc8+_0x205e55(0x13a)+_0x20103e+_0x205e55(0xf9)+_0x740dc8[_0x205e55(0x1b4)]),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}if(_0x33ba9f[_0x205e55(0x101)]&&(_0x33ba9f[_0x205e55(0x101)]<0xc8||_0x33ba9f['status']>0x12b)){if(_0x33ba9f['body']){if(_0x33ba9f[_0x205e55(0x17f)]['detail']){let _0x539b9d=_0x33ba9f[_0x205e55(0x17f)]['detail'];_0x539b9d=_0x539b9d[_0x205e55(0x1a5)](_0x1b5b69[_0x205e55(0x10f)]+'['+_0x1b5b69[_0x205e55(0x18f)]+']',''+_0x457fc8),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](''+_0x539b9d);}else{if(_0x33ba9f[_0x205e55(0x17f)]['Errors']&&Array[_0x205e55(0x141)](_0x33ba9f[_0x205e55(0x17f)][_0x205e55(0x1ad)])&&_0x33ba9f[_0x205e55(0x17f)][_0x205e55(0x1ad)][_0x205e55(0x172)]>0x0){let _0x2232d2=_0x33ba9f[_0x205e55(0x17f)]['Errors'][0x0][_0x205e55(0x138)];_0x2232d2=_0x2232d2[_0x205e55(0x1a5)](_0x1b5b69[_0x205e55(0x10f)]+'['+_0x1b5b69['pluginName']+']',''+_0x457fc8),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x188)](''+_0x2232d2);}}}}if(_0x51a98e['usePutSoftSync']){const [_0x1beee7,_0x2adddd]=_0x1b5b69['convertedScim20']({'Operations':_0x588661[_0x205e55(0x145)]});if(_0x2adddd){_0x1b5b69[_0x205e55(0x170)]['error'](_0x457fc8+'\x20Replace\x20User\x20id='+_0x20103e+'\x20convertedScim20\x20error:\x20'+_0x2adddd[_0x205e55(0x1b4)]),_0x1b5b69[_0x205e55(0x170)][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);return;}const _0x1c99d0=[];if(_0x1beee7['roles']&&Array[_0x205e55(0x141)](_0x1beee7[_0x205e55(0x1b7)]))for(let _0x58cdb3=0x0;_0x58cdb3<_0x1beee7[_0x205e55(0x1b7)][_0x205e55(0x172)];_0x58cdb3++){_0x1beee7[_0x205e55(0x1b7)][_0x58cdb3]['operation']&&_0x1beee7[_0x205e55(0x1b7)][_0x58cdb3][_0x205e55(0x12b)]===_0x205e55(0x11f)&&_0x1c99d0[_0x205e55(0x176)](_0x1beee7[_0x205e55(0x1b7)][_0x58cdb3]);}if(_0x1c99d0['length']>0x0)try{await _0x1b5b69['modifyUser'](_0xf45a2b,_0x20103e,{'roles':_0x1c99d0});}catch(_0x4d73f2){_0x1b5b69[_0x205e55(0x170)]['error'](_0x457fc8+_0x205e55(0x13a)+_0x20103e+_0x205e55(0x143)+_0x4d73f2[_0x205e55(0x1b4)]);}const _0x710ecf=[];if(_0x1beee7[_0x205e55(0x12a)]&&Array['isArray'](_0x1beee7[_0x205e55(0x12a)]))for(let _0x48e928=0x0;_0x48e928<_0x1beee7[_0x205e55(0x12a)]['length'];_0x48e928++){_0x1beee7[_0x205e55(0x12a)][_0x48e928][_0x205e55(0x12b)]&&_0x1beee7[_0x205e55(0x12a)][_0x48e928][_0x205e55(0x12b)]===_0x205e55(0x11f)&&_0x710ecf[_0x205e55(0x176)](_0x1beee7[_0x205e55(0x12a)][_0x48e928]);}if(_0x710ecf[_0x205e55(0x172)]>0x0)for(let _0x28651d=0x0;_0x28651d<_0x710ecf['length'];_0x28651d++){try{await _0x1b5b69[_0x205e55(0x196)](_0xf45a2b,_0x710ecf[_0x28651d]['id'],{'members':[{'operation':_0x205e55(0x11f),'value':_0x20103e}]});}catch(_0x4948cb){_0x1b5b69['logger'][_0x205e55(0x188)](_0x457fc8+'\x20Replace\x20User\x20id='+_0x20103e+_0x205e55(0x15c)+_0x4948cb['message']);}}}}}_0x1b5b69['logger'][_0x205e55(0x132)](_0x457fc8+_0x205e55(0x17b)+_0x1a761a);}catch(_0x250e68){_0x1b5b69[_0x205e55(0x170)]['error'](_0x1b5b69[_0x205e55(0x10f)]+'['+_0x1b5b69[_0x205e55(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+']\x20error:\x20'+_0x250e68['message']+_0x205e55(0x1ba)+_0x1a761a);}},_0x8f9f70=nats[_0x714335(0x162)](),_0x1f060c=_0x496767[_0x714335(0x12c)](),_0x43bdeb=('durable_'+_0x1b5b69[_0x714335(0x18f)]+'_'+_0xf45a2b)[_0x714335(0x139)]('*','#')[_0x714335(0x139)]('>','##')[_0x714335(0x139)]('.','_');let _0x28fbc8;const _0x163836=async()=>{const _0x1ba13f=_0x714335;try{const _0x874ea=''+_0x51a98e[_0x1ba13f(0xf6)]['tenant'],_0x142ec9=await _0x496767[_0x1ba13f(0x1a0)](),_0x41a175=async()=>{const _0x2a362f=_0x1ba13f;let _0x41a21c;try{_0x41a21c=await _0x1f060c[_0x2a362f(0x185)]['get'](_0x874ea,_0x43bdeb);}catch(_0x34b801){await _0x142ec9['consumers']['add'](_0x874ea,{'durable_name':_0x43bdeb,'ack_policy':nats[_0x2a362f(0x19c)][_0x2a362f(0x1ac)],'deliver_policy':nats['DeliverPolicy'][_0x2a362f(0x18d)],'deliver_group':_0x51a98e?.['nats']?.[_0x2a362f(0x1b9)]||null,'filter_subject':_0xbf5b23}),_0x41a21c=await _0x1f060c[_0x2a362f(0x185)][_0x2a362f(0x108)](_0x874ea,_0x43bdeb);}(_0xbf5b23!==_0x41a21c?.[_0x2a362f(0x117)]?.['config']?.[_0x2a362f(0x107)]||_0x51a98e?.[_0x2a362f(0xf6)]?.[_0x2a362f(0x1b9)]!==_0x41a21c?.[_0x2a362f(0x117)]?.[_0x2a362f(0x125)]?.[_0x2a362f(0x1bf)])&&(await _0x142ec9[_0x2a362f(0x185)][_0x2a362f(0x142)](_0x874ea,_0x43bdeb,{'deliver_group':_0x51a98e?.['nats']?.['queueGroup']||null,'filter_subject':_0xbf5b23}),_0x41a21c=await _0x1f060c[_0x2a362f(0x185)]['get'](_0x874ea,_0x43bdeb)),_0x28fbc8=await _0x41a21c[_0x2a362f(0x148)]({'max_messages':0x64});};await _0x41a175();const _0x271ca6=async()=>{const _0x4247a5=_0x1ba13f;for await(const _0x3e80e5 of await _0x28fbc8[_0x4247a5(0x101)]()){switch(_0x3e80e5['type']){case nats['ConsumerEvents']['ConsumerNotFound']:if(_0x3e80e5[_0x4247a5(0x169)]===0x1)_0x1b5b69[_0x4247a5(0x170)][_0x4247a5(0x135)](_0x1b5b69[_0x4247a5(0x10f)]+'['+_0x1b5b69[_0x4247a5(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+_0x4247a5(0x15f)+_0x3e80e5[_0x4247a5(0xfd)]),_0x41a175();else _0x3e80e5[_0x4247a5(0x169)]%0xa===0x0&&_0x1b5b69['logger'][_0x4247a5(0x188)](_0x1b5b69[_0x4247a5(0x10f)]+'['+_0x1b5b69[_0x4247a5(0x18f)]+_0x4247a5(0x15a)+_0xf45a2b+']['+_0xbf5b23+']\x20client\x20consumer\x20error:\x20'+_0x3e80e5[_0x4247a5(0xfd)]+_0x4247a5(0x181)+_0x3e80e5['data']);break;}}};_0x271ca6();for await(const _0x159352 of _0x28fbc8){if(!_0x159352[_0x1ba13f(0x17d)]||!_0x159352[_0x1ba13f(0x17d)][_0x1ba13f(0x108)](_0x1ba13f(0x18a))){_0x159352[_0x1ba13f(0x126)]();continue;}const _0x1d5cb3=_0x1b5b69[_0x1ba13f(0x10f)]+'['+_0x1b5b69[_0x1ba13f(0x18f)]+_0x1ba13f(0x15a)+_0xf45a2b+']['+_0x159352[_0x1ba13f(0x147)]+']['+_0x28fbc8['getProcessed']()+']['+(_0x159352[_0x1ba13f(0x17d)]?_0x159352['headers'][_0x1ba13f(0x108)]('Msg-Id'):'')+']',_0x3a8c7b=_0x8f9f70[_0x1ba13f(0x1b0)](_0x159352[_0x1ba13f(0x169)]);await _0x1fa7c2(_0x1d5cb3,_0x3a8c7b),_0x159352[_0x1ba13f(0x126)]();}}catch(_0x388062){_0x1b5b69[_0x1ba13f(0x170)][_0x1ba13f(0x188)](_0x1b5b69['gwName']+'['+_0x1b5b69['pluginName']+_0x1ba13f(0x15a)+_0xf45a2b+']['+_0xbf5b23+']\x20subscriber\x20stopped\x20error:\x20'+_0x388062['message']);}};_0x163836();const _0x16ee92=async()=>{const _0x2504f1=_0x714335;let _0x2e6e59=0x0;for await(const _0x632557 of _0x496767[_0x2504f1(0x101)]()){switch(_0x632557[_0x2504f1(0xfd)]){case nats['Events'][_0x2504f1(0x14a)]:_0x1b5b69[_0x2504f1(0x170)][_0x2504f1(0x188)](_0x1b5b69[_0x2504f1(0x10f)]+'['+_0x1b5b69['pluginName']+_0x2504f1(0x15a)+_0xf45a2b+']['+_0xbf5b23+']\x20client\x20disconnected\x20'+_0x632557['data']+'\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available'),_0x2e6e59=0x0;break;case nats[_0x2504f1(0x15e)]['Reconnect']:_0x1b5b69[_0x2504f1(0x170)][_0x2504f1(0x135)](_0x1b5b69[_0x2504f1(0x10f)]+'['+_0x1b5b69[_0x2504f1(0x18f)]+_0x2504f1(0x15a)+_0xf45a2b+']['+_0xbf5b23+_0x2504f1(0x1a9)+_0x632557[_0x2504f1(0x169)]);try{if(_0x28fbc8[_0x2504f1(0x127)])await _0x28fbc8[_0x2504f1(0x127)]();}catch(_0x2c773e){if(_0x28fbc8[_0x2504f1(0x1bc)])_0x28fbc8[_0x2504f1(0x1bc)]();}break;case nats['Events']['Error']:_0x1b5b69['logger']['error'](_0x1b5b69[_0x2504f1(0x10f)]+'['+_0x1b5b69[_0x2504f1(0x18f)]+_0x2504f1(0x15a)+_0xf45a2b+']['+_0xbf5b23+_0x2504f1(0x17e)+_0x632557[_0x2504f1(0x169)]);break;case nats['DebugEvents']['Reconnecting']:_0x2e6e59+=0x1;_0x2e6e59%0x1e===0x0&&_0x1b5b69[_0x2504f1(0x170)][_0x2504f1(0x132)](_0x1b5b69['gwName']+'['+_0x1b5b69[_0x2504f1(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+_0x2504f1(0x11e)+_0x632557[_0x2504f1(0x169)]+'\x20(count='+_0x2e6e59+')');break;case nats[_0x2504f1(0x118)][_0x2504f1(0x14e)]:_0x1b5b69[_0x2504f1(0x170)]['debug'](_0x1b5b69[_0x2504f1(0x10f)]+'['+_0x1b5b69[_0x2504f1(0x18f)]+']\x20subscriber['+_0xf45a2b+']['+_0xbf5b23+_0x2504f1(0x18c)+_0x632557[_0x2504f1(0x169)]);break;}}};_0x16ee92(),process['on']('SIGTERM',async()=>{const _0x2d097c=_0x714335;_0x496767&&await _0x496767[_0x2d097c(0x114)]();}),process['on'](_0x714335(0x174),async()=>{const _0x3c0a14=_0x714335;_0x496767&&await _0x496767[_0x3c0a14(0x114)]();});};const _0x41c8ed=async(_0x38edb6,_0x341584)=>{const _0x260d58=_0xbbad37,_0x450738={'attribute':_0x38edb6,'operator':'eq','value':_0x341584,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0xf69688=[_0x38edb6];if(_0x38edb6!=='id')_0xf69688[_0x260d58(0x176)]('id');try{const _0x50e550=await _0x1b5b69[_0x260d58(0x192)](_0xf45a2b,_0x450738,_0xf69688);if(!_0x50e550||!_0x50e550[_0x260d58(0x1a3)]||!Array[_0x260d58(0x141)](_0x50e550[_0x260d58(0x1a3)]))throw new Error(_0x260d58(0x149)+JSON[_0x260d58(0x13b)](_0x450738)+_0x260d58(0x1c0));if(_0x50e550[_0x260d58(0x1a3)][_0x260d58(0x172)]===0x0)return null;else{if(_0x50e550[_0x260d58(0x1a3)]['length']>0x2)throw new Error(_0x260d58(0x149)+JSON['stringify'](_0x450738)+_0x260d58(0x186));else{const _0xbb55d8=_0x50e550[_0x260d58(0x1a3)][0x0];if(!_0xbb55d8['id'])throw new Error(_0x260d58(0x149)+JSON['stringify'](_0x450738)+_0x260d58(0xf7)+JSON[_0x260d58(0x13b)](_0xbb55d8)+_0x260d58(0x134));return decodeURIComponent(_0xbb55d8['id']);}}}catch(_0x596add){throw new Error(_0x260d58(0x149)+JSON[_0x260d58(0x13b)](_0x450738)+_0x260d58(0xf9)+_0x596add['message']+'}');}},_0xc86e53=_0x37a0c1=>{const _0x51c5bb=_0xbbad37;if(!_0x37a0c1||typeof _0x37a0c1!==_0x51c5bb(0x1b6))return[null,null];_0x37a0c1=_0x37a0c1[_0x51c5bb(0xf8)]();const _0x5508e9=_0x37a0c1[_0x51c5bb(0x121)]('(');if(_0x5508e9<0x1)return[null,null];if(_0x37a0c1[_0x51c5bb(0x16d)](_0x37a0c1['length']-0x1)!==')')return[null,null];if(_0x58509e(_0x37a0c1,'(')!==_0x58509e(_0x37a0c1,')'))return[null,null];const _0x45ce57=_0x37a0c1[_0x51c5bb(0x16d)](0x0,_0x5508e9),_0x5c28aa=_0x37a0c1[_0x51c5bb(0x16d)](_0x5508e9+0x1,_0x37a0c1[_0x51c5bb(0x172)]-0x1);let _0x363710=[];const _0x1e4037=_0x5c28aa[_0x51c5bb(0xff)](',');let _0x386956='';for(let _0x4bec25=0x0;_0x4bec25<_0x1e4037[_0x51c5bb(0x172)];_0x4bec25++){const _0xa9de1f=_0x386956?_0x386956+','+_0x1e4037[_0x4bec25]:_0x1e4037[_0x4bec25],_0x563eb9=_0x58509e(_0xa9de1f,'('),_0x386037=_0x58509e(_0xa9de1f,')');if(_0x563eb9===_0x386037)_0x363710[_0x51c5bb(0x176)](_0x41cb8f(_0xa9de1f,'\x22')),_0x386956='';else{if(_0x386956)_0x386956+=','+_0x1e4037[_0x4bec25];else _0x386956+=_0x1e4037[_0x4bec25];}}if(_0x363710[_0x51c5bb(0x172)]===0x0)_0x363710=null;return[_0x45ce57,_0x363710];};function _0x58509e(_0x544d4d,_0x250097){const _0x53b31f=_0xbbad37;let _0x412704=0x0;for(let _0x43d2c9=0x0;_0x43d2c9<_0x544d4d[_0x53b31f(0x172)];_0x43d2c9++){_0x544d4d['charAt'](_0x43d2c9)===_0x250097&&(_0x412704+=0x1);}return _0x412704;}const _0x41cb8f=(_0x4e8cb6,_0x2d3bf0)=>{const _0x1e0401=_0xbbad37;if(typeof _0x4e8cb6!==_0x1e0401(0x1b6)||typeof _0x2d3bf0!==_0x1e0401(0x1b6))return _0x4e8cb6;if(_0x4e8cb6['length']===0x1)return _0x4e8cb6;if(_0x2d3bf0[_0x1e0401(0x172)]!==0x1)return _0x4e8cb6;return _0x4e8cb6=_0x4e8cb6[_0x1e0401(0xf8)](),_0x4e8cb6[_0x1e0401(0x16d)](0x0,0x1)===_0x2d3bf0&&(_0x4e8cb6=_0x4e8cb6[_0x1e0401(0x16d)](0x1)),_0x4e8cb6[_0x1e0401(0x16d)](_0x4e8cb6['length']-0x1)===_0x2d3bf0&&(_0x4e8cb6=_0x4e8cb6['substring'](0x0,_0x4e8cb6[_0x1e0401(0x172)]-0x1)),_0x4e8cb6;},_0x4954c4=async(_0x21c4d1,_0x161bb9,_0x500bd3)=>{const _0x57bc7f=_0xbbad37;if(!_0x21c4d1||!_0x161bb9||!_0x500bd3)return null;const [_0xcc3fc9,_0x508a96]=_0xc86e53(_0x500bd3);if(!_0xcc3fc9||!_0x508a96){const _0x2d2f38=_0x500bd3['split']('(');if(_0x2d2f38[_0x57bc7f(0x172)]>0x1){const _0x5ec68b=[_0x57bc7f(0x165),_0x57bc7f(0x144),_0x57bc7f(0x137),'elementnumber',_0x57bc7f(0x14c),_0x57bc7f(0x1a5),_0x57bc7f(0x12e),_0x57bc7f(0x113),'getuniquevalue'],_0x10db09=_0x2d2f38[0x0]['toLowerCase']();if(_0x5ec68b[_0x57bc7f(0x163)](_0x10db09))return null;}return _0x500bd3;}for(let _0x4c02ba=0x0;_0x4c02ba<_0x508a96['length'];_0x4c02ba++){if(_0x508a96[_0x4c02ba][_0x57bc7f(0x16d)](0x0,0x1)==='['){const _0x1a583f=_0x508a96[_0x4c02ba][_0x57bc7f(0x121)](']');if(_0x1a583f<0x0)return null;const _0x3a5918=_0x508a96[_0x4c02ba]['substring'](0x1,_0x1a583f),_0x333e83=_0x3a5918[_0x57bc7f(0xff)]('.');let _0x121cf5;for(let _0x19b301=0x0;_0x19b301<_0x333e83[_0x57bc7f(0x172)];_0x19b301++){if(_0x19b301===0x0)_0x121cf5=_0x21c4d1[_0x333e83[_0x19b301]];else{if(!_0x121cf5)return null;_0x121cf5=_0x121cf5[_0x333e83[_0x19b301]];}}if(!_0x121cf5)return null;_0x508a96[_0x4c02ba]=_0x121cf5;}}for(let _0x206d0c=0x0;_0x206d0c<_0x508a96['length'];_0x206d0c++){const [_0x4b2cf6]=_0xc86e53(_0x508a96[_0x206d0c]);_0x4b2cf6&&(_0x508a96[_0x206d0c]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x508a96[_0x206d0c]));}if(_0x508a96[0x0]===null)return null;switch(_0xcc3fc9['toLowerCase']()){case _0x57bc7f(0x165):{if(_0x508a96[_0x57bc7f(0x172)]!==0x1)return null;const [_0x1c5e1a]=_0xc86e53(_0x508a96[0x0]);if(_0x1c5e1a)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x1c5e1a);if(_0x508a96[0x0]===null)return null;return _0x508a96[0x0]['toLowerCase']();}case _0x57bc7f(0x144):{if(_0x508a96['length']!==0x1)return null;const [_0x410306]=_0xc86e53(_0x508a96[0x0]);if(_0x410306)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x410306);if(_0x508a96[0x0]===null)return null;return _0x508a96[0x0][_0x57bc7f(0x13e)]();}case _0x57bc7f(0x137):{if(_0x508a96[_0x57bc7f(0x172)]!==0x2)return null;const [_0x1122f7]=_0xc86e53(_0x508a96[0x0]);if(_0x1122f7)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x1122f7);if(_0x508a96[0x0]===null)return null;if(isNaN(_0x508a96[0x1]))return null;return _0x508a96[0x0][_0x57bc7f(0x16d)](0x0,_0x508a96[0x1]);}case _0x57bc7f(0x19e):{const [_0x171fda]=_0xc86e53(_0x508a96[0x0]);if(_0x508a96['length']<0x2)return null;if(_0x171fda)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x171fda);if(_0x508a96[0x0]===null)return null;const _0x1580f0=_0x508a96[0x1];if(isNaN(_0x1580f0))return null;let _0x3e1639;if(_0x508a96[_0x57bc7f(0x172)]===0x3)_0x3e1639=_0x508a96[0x0][_0x57bc7f(0xff)](_0x508a96[0x2]);else _0x3e1639=_0x3e1639=_0x508a96[0x0][_0x57bc7f(0xff)]('\x20');if(_0x1580f0<=_0x3e1639[_0x57bc7f(0x172)])return _0x3e1639[_0x1580f0-0x1];else return'';}case _0x57bc7f(0x1a5):{const [_0x119ba5]=_0xc86e53(_0x508a96[0x0]);if(_0x119ba5)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x119ba5);if(_0x508a96[0x0]===null)return null;if(_0x508a96[_0x57bc7f(0x172)]!==0x3)return null;return _0x508a96[0x0]['replaceAll'](_0x508a96[0x1],_0x508a96[0x2]);}case _0x57bc7f(0x12e):{if(_0x508a96[_0x57bc7f(0x172)]!==0x1)return null;const [_0x483ece]=_0xc86e53(_0x508a96[0x0]);if(_0x483ece)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x483ece);if(_0x508a96[0x0]===null)return null;return ascii127[_0x57bc7f(0x156)](_0x508a96[0x0]);}case _0x57bc7f(0x14c):{let _0x3720b2='';for(let _0x4af84b=0x0;_0x4af84b<_0x508a96[_0x57bc7f(0x172)];_0x4af84b++){const [_0x1a6cc7]=_0xc86e53(_0x508a96[_0x4af84b]);if(_0x1a6cc7)_0x508a96[_0x4af84b]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x1a6cc7);if(_0x508a96[_0x4af84b]===null)return null;_0x3720b2+=_0x508a96[_0x4af84b];}return _0x3720b2;}case _0x57bc7f(0x113):{if(_0x508a96[_0x57bc7f(0x172)]>0x2)return null;const [_0x27e51b]=_0xc86e53(_0x508a96[0x0]);if(_0x27e51b)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x27e51b);if(_0x508a96[0x0]===null)return null;const _0x5264b6=parseInt(_0x508a96[0x0]);if(isNaN(_0x5264b6))return null;let _0x16903c=_0x57bc7f(0x110);_0x16903c+=','+_0x508a96[0x0];if(_0x508a96[_0x57bc7f(0x172)]===0x2&&_0x508a96[0x1][_0x57bc7f(0x1a2)]()==='true')_0x16903c+=_0x57bc7f(0x12d);else _0x16903c+=',false';return _0x16903c+='##',_0x16903c;}case _0x57bc7f(0x10d):{if(_0x508a96['length']!==0x1)return null;const [_0x519cfe]=_0xc86e53(_0x508a96[0x0]);if(_0x519cfe)_0x508a96[0x0]=await _0x4954c4(_0x21c4d1,_0x161bb9,_0x519cfe);if(_0x508a96[0x0]===null)return null;let _0x2df61a,_0x28f3ec=![],_0x3c29ba='';const _0x51f0e6=_0x508a96[0x0][_0x57bc7f(0xff)]('##');if(_0x51f0e6[_0x57bc7f(0x172)]>0x2)for(let _0x1e5d37=0x0;_0x1e5d37<_0x51f0e6['length'];_0x1e5d37++){if(_0x51f0e6[_0x1e5d37][_0x57bc7f(0x164)]('doIncrement')){const _0x25abb9=_0x51f0e6[_0x1e5d37][_0x57bc7f(0xff)](',');if(_0x25abb9[_0x57bc7f(0x172)]<0x2)return null;const _0x5180cb=parseInt(_0x25abb9[0x1]);if(isNaN(_0x5180cb))return null;_0x3c29ba='##'+_0x51f0e6[_0x1e5d37]+'##',_0x2df61a=_0x25abb9[0x1],_0x25abb9[_0x57bc7f(0x172)]>0x2&&(_0x28f3ec=_0x25abb9[0x2][_0x57bc7f(0x1a2)]()===_0x57bc7f(0x1a8));}}let _0x58c654,_0x6881dc=0x0,_0x3f1e13=0x0;if(_0x2df61a){_0x3f1e13=_0x2df61a[_0x57bc7f(0x172)],_0x6881dc=0xa;for(let _0x376afb=0x1;_0x376afb<_0x3f1e13;_0x376afb++){_0x6881dc*=0xa;}_0x6881dc-=0x1,_0x58c654=parseInt(_0x2df61a);if(isNaN(_0x58c654))return null;_0x58c654-=0x1;}else _0x58c654=0x0;do{_0x58c654+=0x1;let _0x54db33=_0x508a96[0x0];if(_0x2df61a!==undefined&&_0x3c29ba){let _0x5e2a2f=_0x58c654[_0x57bc7f(0x1a1)]();while(_0x5e2a2f[_0x57bc7f(0x172)]<_0x3f1e13){_0x5e2a2f='0'+_0x5e2a2f;}_0x28f3ec?_0x54db33=_0x54db33[_0x57bc7f(0x1a5)](_0x3c29ba,_0x5e2a2f):(_0x54db33=_0x54db33[_0x57bc7f(0x1a5)](_0x3c29ba,''),_0x28f3ec=!![],_0x58c654-=0x1);}try{const _0x1879d3=await _0x41c8ed(_0x161bb9,_0x54db33);if(!_0x1879d3)return _0x54db33;}catch(_0x3d00f0){return _0x1b5b69['logger'][_0x57bc7f(0x188)](_0x1b5b69[_0x57bc7f(0x10f)]+'['+_0x1b5b69[_0x57bc7f(0x18f)]+']\x20'+_0xcc3fc9+_0x57bc7f(0x155)+_0x3d00f0[_0x57bc7f(0x1b4)]),null;}}while(_0x58c654<_0x6881dc);return null;}default:}return null;},_0x2b8d29=async _0x194a4f=>{const _0x16e799=_0xbbad37;for(const _0xd1378f in _0x194a4f){const _0x47f63b=_0x194a4f[_0xd1378f],[_0x41f45a,_0x554434]=_0xc86e53(_0x47f63b);if(_0x41f45a){const _0x1889e0=''+_0xd1378f,_0x375176=_0x41f45a+'('+_0x554434[_0x16e799(0x14c)](',')+')',_0x25af4b=await _0x4954c4(_0x194a4f,_0x1889e0,_0x375176);if(_0x25af4b===null)delete _0x194a4f[_0xd1378f];else _0x194a4f[_0xd1378f]=_0x25af4b;}for(const _0x515c5b in _0x47f63b){const _0x18f4ef=_0x47f63b[_0x515c5b],[_0x2b839e,_0x1ac6c7]=_0xc86e53(_0x18f4ef);if(_0x2b839e){const _0xcdc2f9=_0xd1378f+'.'+_0x515c5b,_0x343017=_0x2b839e+'('+_0x1ac6c7['join'](',')+')',_0xd5d493=await _0x4954c4(_0x194a4f,_0xcdc2f9,_0x343017);if(_0xd5d493===null)delete _0x47f63b[_0x515c5b];else _0x47f63b[_0x515c5b]=_0xd5d493;}}}return _0x194a4f;};},module[a0_0x1411a2(0x18b)]['getAppRoles']=async(_0x269b83,_0x41cd39,_0x3c323b,_0xab541b)=>{const _0x39d4cb=a0_0x1411a2,_0x4c4302=_0x39d4cb(0x184),_0x50ef1d=_0x269b83;_0x50ef1d[_0x39d4cb(0x170)][_0x39d4cb(0x132)](_0x50ef1d[_0x39d4cb(0x10f)]+'['+_0x50ef1d[_0x39d4cb(0x18f)]+_0x39d4cb(0x1b1)+_0x4c4302+'\x22');try{if(!fs[_0x39d4cb(0x129)](_0x50ef1d[_0x39d4cb(0x105)]+_0x39d4cb(0x153)))fs[_0x39d4cb(0x16c)](_0x50ef1d['configDir']+_0x39d4cb(0x153));}catch(_0x627b){}const _0x449744=path['join'](''+_0x50ef1d[_0x39d4cb(0x105)],_0x39d4cb(0xfb),_0x39d4cb(0x116)+_0x50ef1d[_0x39d4cb(0x18f)]+'_autogenerated.cfg'),_0x503364={};utils[_0x39d4cb(0x10c)](_0x449744)&&fs['readFileSync'](_0x449744,_0x39d4cb(0x17c))['split'](/\r?\n/)[_0x39d4cb(0xfa)](_0x6cc593=>{const _0x1d031c=_0x39d4cb,_0xd73676=_0x6cc593[_0x1d031c(0xff)]('\x20');_0xd73676[_0x1d031c(0x172)]===0x2&&(_0x503364[_0xd73676[0x0]]=_0xd73676[0x1]);});const _0x3358f8=fs[_0x39d4cb(0x115)](_0x449744,{'flags':'w','encoding':'utf8','mode':0x1b6,'autoClose':!![]}),_0x2fac1c=[],_0x3d7d84=await _0x50ef1d['getGroups'](_0x41cd39,{'attribute':undefined,'operator':undefined,'value':undefined},['id',_0x39d4cb(0x16b)]);return _0x3d7d84[_0x39d4cb(0x1a3)][_0x39d4cb(0xfa)](_0x393f9a=>{const _0x883997=_0x39d4cb;if(_0x393f9a['id']){let _0x9fedaf=crypto[_0x883997(0x104)]();if(_0x503364[_0x393f9a['id']])_0x9fedaf=_0x503364[_0x393f9a['id']];const _0x3507f1={'allowedMemberTypes':[_0x883997(0x10e)],'description':'SCIM\x20Stream\x20-\x20Autogenerated','displayName':_0x393f9a['displayName']||_0x393f9a['id'],'id':_0x9fedaf,'isEnabled':!![],'lang':null,'origin':_0x883997(0x19d),'value':decodeURIComponent(_0x393f9a['id'])};_0x2fac1c[_0x883997(0x176)](_0x3507f1),_0x3358f8[_0x883997(0x13f)](_0x393f9a['id']+'\x20'+_0x9fedaf+'\x0a');}}),_0x3358f8['close'](),_0x50ef1d[_0x39d4cb(0x170)][_0x39d4cb(0x132)](_0x50ef1d[_0x39d4cb(0x10f)]+'['+_0x50ef1d[_0x39d4cb(0x18f)]+_0x39d4cb(0x1b2)+_0x449744),{'Resources':[{'appRoles':_0x2fac1c}]};};function a0_0x4879(){const _0x15416b=['\x20missing\x20user\x20object\x20in\x20message:\x20','pingInterval','modifyGroup','request',']\x20subscriber\x20error:\x20configuration\x20scim.usePutSoftSync\x20must\x20be\x20set\x20to\x20true','jwt','11fqtDHk','transports','AckPolicy','Application','elementnumber','servers','jetstreamManager','toString','toLowerCase','Resources','display','replace','6MQgCHF','maxPingOut','true',']\x20client\x20reconnected\x20','\x20Create\x20userName=','\x20should\x20have\x20syntax:\x20<collector>.<channel>','Explicit','Errors','onCreate','active','decode',']\x20handling\x20\x22',']\x20approle\x20uuid\x20file\x20created:\x20','usePutSoftSync','message','\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false','string','roles',']\x20connect\x20error:\x20','queueGroup','\x20=>\x20subscriber\x20not\x20activated','2phKdrN','unsubscribe','99Dzpzks','connect','deliver_group','\x20error:\x20missing\x20result','userName','nats','\x20result=','trim','\x20error:\x20','forEach','approles','subscribe','type','16eqgiys','split','false','status','../lib/utils','195200ONtCea','randomUUID','configDir','certificate','filter_subject','get','readFileSync','baseUrls','\x20message:\x20user\x20does\x20not\x20exist','fsExistsSync','getuniquevalue','User','gwName','##doIncrement','606980iBjpxJ','level','increment','drain','createWriteStream','approles_','_info','DebugEvents','createUser','2730260PzSmiM','modifyOnly','file','2588117ywbgdu',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20','delete','name','indexOf',']\x20subscriber\x20certificate\x20error:\x20','\x20createUser()\x20obj=','encode','config','ack','consumerInfo','\x20-\x20','existsSync','groups','operation','jetstream',',true','normalize','copyObj','Subscriber','generateUserPassword','debug','\x20message:\x20','\x20error:\x20missing\x20id}','info','/Users/','firstn','description','replaceAll','\x20Replace\x20User\x20id=','stringify','\x20Delete\x20User\x20id=',']\x20error:\x20missing\x20one\x20or\x20more\x20mandatory\x20configurations\x20e.g.\x20stream.baseUrls,\x20stream.certificate.ca,\x20nats.tenant,\x20nats.subject,\x20nats.secret\x20and\x20nats.jwt','toUpperCase','write','waitOnFirstConnect','isArray','update','\x20role\x20removal\x20error:\x20','uppercase','Operations','replaceDomains','subject','consume','getUsers()\x20getObj=','Disconnect','prototype','join','crypto','StaleConnection','secret','closed','\x20roles\x20converted\x20to\x20groups\x20message:\x20','originalUrl','/approles','skipConvertRolesToGroups','\x20getUserId()\x20error:\x20','foldReplacing','getServer','tls','activityOperation',']\x20subscriber[','\x20handling\x20message:\x20','\x20group\x20removal\x20error:\x20','authenticator','Events',']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20','path','deleteUser','StringCodec','includes','startsWith','lowercase','hasOwnProperty','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true','\x20Delete\x20User\x20userName=','data','fold-to-ascii','displayName','mkdirSync','substring',']\x20error:\x20subject\x20not\x20allowing\x20comma\x20separated\x20multiples','20623236AKvPBN','logger','from','length','value','SIGINT','1587606TEyRMd','push','parse',']\x20error:\x20client\x20have\x20not\x20been\x20initialized','set','then','\x20done','utf-8','headers',']\x20client\x20error\x20','body','schemas','\x20count=','deleteUserOnLastGroupRoleRemoval','params','getAppRoles','consumers','\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}','\x20Create\x20User\x20userName=','error','baseEntity','Msg-Id','exports',']\x20client\x20has\x20a\x20stale\x20connection\x20','New','488100qWTawF','pluginName','call','createRandomPassword','getUsers','password'];a0_0x4879=function(){return _0x15416b;};return a0_0x4879();}
13
+ 'use strict';function a0_0x5d24(_0x34e02f,_0x5e545f){const _0x5dd086=a0_0x5dd0();return a0_0x5d24=function(_0x5d24dd,_0x150eb7){_0x5d24dd=_0x5d24dd-0x1df;let _0x3df8e4=_0x5dd086[_0x5d24dd];return _0x3df8e4;},a0_0x5d24(_0x34e02f,_0x5e545f);}const a0_0x4938eb=a0_0x5d24;(function(_0x43e191,_0x19c8ff){const _0x280594=a0_0x5d24,_0x1a8494=_0x43e191();while(!![]){try{const _0x2c107f=parseInt(_0x280594(0x22b))/0x1+parseInt(_0x280594(0x29d))/0x2+parseInt(_0x280594(0x1f5))/0x3+-parseInt(_0x280594(0x294))/0x4*(-parseInt(_0x280594(0x260))/0x5)+-parseInt(_0x280594(0x23d))/0x6*(parseInt(_0x280594(0x272))/0x7)+-parseInt(_0x280594(0x1e3))/0x8*(-parseInt(_0x280594(0x287))/0x9)+-parseInt(_0x280594(0x1fb))/0xa;if(_0x2c107f===_0x19c8ff)break;else _0x1a8494['push'](_0x1a8494['shift']());}catch(_0x235f9c){_0x1a8494['push'](_0x1a8494['shift']());}}}(a0_0x5dd0,0x34b1f));function a0_0x5dd0(){const _0x4264c9=['indexOf','getProcessed','\x20createUser()\x20obj=','approles_','modifyUser','getAppRoles','\x20error:\x20missing\x20result','transports','secret',']\x20error:\x20subject\x20',']\x20error:\x20subject\x20not\x20allowing\x20comma\x20separated\x20multiples',']\x20client\x20error\x20','info','substring','getuniquevalue','convertedScim20','Reconnecting','createWriteStream','Application','\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}','logger','write','ConsumerNotFound','waitOnFirstConnect','includes','displayName','toString','5XrxlLf','maxReconnectAttempts','unsubscribe','remove',']\x20error:\x20client\x20have\x20not\x20been\x20initialized','baseEntity','\x20Replace\x20User\x20id=','nats','increment','params','get','\x20Delete\x20User\x20id=','roles','DebugEvents',']\x20approle\x20uuid\x20file\x20created:\x20','deliver_group','##doIncrement','usePutSoftSync','16730hLampn','New','Errors','groups','update','trim','deleteUser','getServer','originalUrl','active','jwt','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available','SIGTERM','prototype','length','durable_','subscribe','pluginName','config','createUser',']\x20subscriber\x20error:\x20missing\x20certificate\x20configuration','3474ieESwK','join','from','closed','DeliverPolicy','replace','ack','data','value','split','message','configDir','\x20Create\x20User\x20userName=','543908ktHKjD','operation','request',',true','\x20roles\x20converted\x20to\x20groups:\x20','jetstreamManager',']\x20connect\x20error:\x20','modifyOnly','\x20-\x20','787014dnyiXr','name','forEach','utf-8','replaceAll','baseUrls','charAt','display','push',']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20',']\x20subscriber[',']\x20error:\x20missing\x20one\x20or\x20more\x20mandatory\x20configurations\x20e.g.\x20stream.baseUrls,\x20stream.certificate.ca,\x20nats.tenant,\x20nats.subject,\x20nats.secret\x20and\x20nats.jwt','Subscriber','false','elementnumber','certificate',']\x20client\x20reconnected\x20','_autogenerated.cfg','deleteUserOnLastGroupRoleRemoval',']\x20client\x20disconnected\x20','typeId','Reconnect','filter_subject',',false','utf8','1624VTFxVj','drain','generateUserPassword','getUsers','decode','true','\x20done','/approles','createRandomPassword','getGroups','userName','\x20convertedScim20\x20error:\x20',']\x20handling\x20\x22','replaceDomains','\x20error:\x20','\x20missing\x20user\x20object\x20in\x20message:\x20','close',']\x20subscriber\x20certificate\x20error:\x20','807117KecqOE','Operations',']\x20subscriber\x20stopped\x20error:\x20','lowercase','headers','tls','6294010GRaYgG','delete','tenant','startsWith','body','StaleConnection','foldReplacing','firstn',']\x20subscriber\x20error:\x20configuration\x20scim.usePutSoftSync\x20must\x20be\x20set\x20to\x20true','modifyGroup','error','\x20error:\x20missing\x20id}','randomUUID','encode','Events',']\x20client\x20consumer\x20error:\x20','fsExistsSync','password','uppercase','_info','Msg-Id','../lib/utils','toUpperCase','consume','AckPolicy','\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20','reconnectTimeWait','/certs/','type','path','reconnect','skipConvertRolesToGroups','\x20=>\x20subscriber\x20not\x20activated','readFileSync','\x20getUserId()\x20error:\x20','\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration','toLowerCase','copyObj','\x20message:\x20user\x20does\x20not\x20exist',']\x20connected\x20','\x20result=','isArray','string',']\x20client\x20has\x20a\x20stale\x20connection\x20','servers','\x20(count=','getUsers()\x20getObj=','status','381829pQemJE','\x20group\x20removal\x20error:\x20','consumers','\x20Create\x20userName=','gwName','exports','add','SIGINT','user','normalize','onCreate','Resources','set','jetstream','StringCodec','\x20should\x20have\x20syntax:\x20<collector>.<channel>','stringify','detail','1038elVXHy','connect','activityOperation','debug','schemas','consumerInfo','crypto',']\x20closed\x20with\x20error:\x20'];a0_0x5dd0=function(){return _0x4264c9;};return a0_0x5dd0();}const nats=require(a0_0x4938eb(0x267)),ascii127=require('fold-to-ascii'),fs=require('fs'),utils=require(a0_0x4938eb(0x210)),path=require(a0_0x4938eb(0x218)),crypto=require(a0_0x4938eb(0x243));module[a0_0x4938eb(0x230)][a0_0x4938eb(0x2a9)]=function(_0x265ac2,_0x3d2e4a,_0x4f5872,_0x32981d){const _0x5e4129=a0_0x4938eb,_0x31290f=_0x265ac2,_0x24a4cf=_0x3d2e4a,_0x51705e=_0x4f5872,_0x258328=_0x32981d;if(!_0x24a4cf[_0x5e4129(0x2ac)]||!_0x24a4cf['certificate']['ca']){_0x31290f[_0x5e4129(0x259)]['error'](_0x31290f[_0x5e4129(0x22f)]+'['+_0x31290f[_0x5e4129(0x283)]+_0x5e4129(0x286));return;}if(!_0x24a4cf[_0x5e4129(0x271)]){_0x31290f[_0x5e4129(0x259)][_0x5e4129(0x205)](_0x31290f[_0x5e4129(0x22f)]+'['+_0x31290f[_0x5e4129(0x283)]+_0x5e4129(0x203));return;}let _0xed36c7='';for(let _0x12e63a=0x0;_0x12e63a<_0x31290f[_0x5e4129(0x259)][_0x5e4129(0x24c)][_0x5e4129(0x280)];_0x12e63a++){if(_0x31290f[_0x5e4129(0x259)][_0x5e4129(0x24c)][_0x12e63a][_0x5e4129(0x29e)]==='file'){_0xed36c7=_0x31290f[_0x5e4129(0x259)][_0x5e4129(0x24c)][_0x12e63a]['level'];break;}}const _0x429c50=''+(_0xed36c7===_0x5e4129(0x240)?'\x0a':''),_0x1b72fe={};try{_0x1b72fe['ca']=[fs[_0x5e4129(0x21c)](_0x31290f[_0x5e4129(0x292)]+_0x5e4129(0x216)+_0x24a4cf[_0x5e4129(0x2ac)]['ca'])];}catch(_0x5d7181){_0x31290f[_0x5e4129(0x259)]['error'](_0x31290f['gwName']+'['+_0x31290f[_0x5e4129(0x283)]+_0x5e4129(0x1f4)+_0x5d7181[_0x5e4129(0x291)]);return;}const _0x5af871={},_0x361a53=new TextEncoder()[_0x5e4129(0x208)](_0x24a4cf['nats'][_0x5e4129(0x24d)]),_0x35a9dc=_0x24a4cf['nats'][_0x5e4129(0x27c)];_0x5af871['authenticator']=nats['jwtAuthenticator'](_0x35a9dc,_0x361a53),_0x5af871[_0x5e4129(0x227)]=_0x24a4cf[_0x5e4129(0x2a2)],_0x5af871['tls']=_0x1b72fe,_0x5af871[_0x5e4129(0x25c)]=![],_0x5af871[_0x5e4129(0x219)]=!![],_0x5af871[_0x5e4129(0x215)]=0x3e8*0xa,_0x5af871[_0x5e4129(0x261)]=-0x1,_0x5af871['pingInterval']=0x2*0x3c*0x3e8,_0x5af871['maxPingOut']=0x5,_0x5af871['debug']=![];let _0x1266da;this['connect']=async()=>{const _0x1f89d5=_0x5e4129;try{_0x1266da=await nats[_0x1f89d5(0x23e)](_0x5af871);}catch(_0x263728){_0x31290f['logger']['error'](_0x31290f[_0x1f89d5(0x22f)]+'['+_0x31290f['pluginName']+_0x1f89d5(0x2a7)+_0x51705e+']['+_0x258328+_0x1f89d5(0x29a)+_0x263728[_0x1f89d5(0x291)]+_0x1f89d5(0x21e)),_0x5af871[_0x1f89d5(0x25c)]=!![];try{_0x1266da=await nats[_0x1f89d5(0x23e)](_0x5af871);}catch(_0x4f0fab){_0x31290f[_0x1f89d5(0x259)]['error'](_0x31290f[_0x1f89d5(0x22f)]+'['+_0x31290f['pluginName']+_0x1f89d5(0x2a7)+_0x51705e+']['+_0x258328+_0x1f89d5(0x29a)+_0x4f0fab['message']);return;}}_0x31290f[_0x1f89d5(0x259)][_0x1f89d5(0x251)](_0x31290f[_0x1f89d5(0x22f)]+'['+_0x31290f[_0x1f89d5(0x283)]+']\x20subscriber['+_0x51705e+']['+_0x258328+_0x1f89d5(0x222)+(_0x5af871[_0x1f89d5(0x1fa)]['ca']?'tls':'')+'\x20'+_0x1266da[_0x1f89d5(0x279)]()),_0x1266da[_0x1f89d5(0x28a)]()['then'](_0x55b93e=>{const _0x1c08b1=_0x1f89d5;_0x55b93e&&_0x31290f[_0x1c08b1(0x259)][_0x1c08b1(0x205)](_0x31290f[_0x1c08b1(0x22f)]+'['+_0x31290f[_0x1c08b1(0x283)]+_0x1c08b1(0x2a7)+_0x51705e+']['+_0x258328+_0x1c08b1(0x244)+_0x55b93e[_0x1c08b1(0x291)]);});},this[_0x5e4129(0x282)]=async()=>{const _0x20cb03=_0x5e4129;if(!_0x258328||!_0x24a4cf['baseUrls']||!_0x24a4cf[_0x20cb03(0x2ac)]||!_0x24a4cf['certificate']['ca']||!_0x24a4cf[_0x20cb03(0x267)]||!_0x24a4cf[_0x20cb03(0x267)][_0x20cb03(0x1fd)]||!_0x24a4cf[_0x20cb03(0x267)][_0x20cb03(0x24d)]||!_0x24a4cf[_0x20cb03(0x267)][_0x20cb03(0x27c)]){_0x31290f['logger'][_0x20cb03(0x205)](_0x31290f[_0x20cb03(0x22f)]+'['+_0x31290f['pluginName']+_0x20cb03(0x2a7)+_0x51705e+']['+_0x258328+_0x20cb03(0x2a8));return;}if(_0x258328[_0x20cb03(0x290)]('.')['length']<0x2){_0x31290f[_0x20cb03(0x259)][_0x20cb03(0x205)](_0x31290f[_0x20cb03(0x22f)]+'['+_0x31290f[_0x20cb03(0x283)]+_0x20cb03(0x2a7)+_0x51705e+']['+_0x258328+_0x20cb03(0x24e)+_0x258328+_0x20cb03(0x23a));return;}if(_0x258328[_0x20cb03(0x25d)](',')){_0x31290f[_0x20cb03(0x259)][_0x20cb03(0x205)](_0x31290f[_0x20cb03(0x22f)]+'['+_0x31290f[_0x20cb03(0x283)]+_0x20cb03(0x2a7)+_0x51705e+']['+_0x258328+_0x20cb03(0x24f));return;}if(!_0x1266da){_0x31290f[_0x20cb03(0x259)][_0x20cb03(0x205)](_0x31290f[_0x20cb03(0x22f)]+'['+_0x31290f['pluginName']+_0x20cb03(0x2a7)+_0x51705e+']['+_0x258328+_0x20cb03(0x264));return;}const _0x4f4f80=async(_0x4efcda,_0x3b0b8d)=>{const _0xf88169=_0x20cb03;try{_0x31290f[_0xf88169(0x259)]['info'](_0x4efcda+'\x20handling\x20message:\x20'+_0x3b0b8d);let _0x33ed57;try{if(_0x24a4cf[_0xf88169(0x1f0)]&&Array[_0xf88169(0x224)](_0x24a4cf[_0xf88169(0x1f0)]))for(let _0x451988=0x0;_0x451988<_0x24a4cf[_0xf88169(0x1f0)]['length'];_0x451988++){const _0x4dced2=_0x24a4cf[_0xf88169(0x1f0)][_0x451988];if(!_0x4dced2[_0xf88169(0x289)]||!_0x4dced2[_0xf88169(0x289)][_0xf88169(0x25d)]('.')||!_0x4dced2['to']||!_0x4dced2['to'][_0xf88169(0x25d)]('.'))continue;const _0xc572b4=new RegExp('@'+_0x4dced2['from']+'\x22','gi');_0x3b0b8d=_0x3b0b8d[_0xf88169(0x28c)](_0xc572b4,'@'+_0x4dced2['to']+'\x22');}_0x33ed57=JSON['parse'](_0x3b0b8d);}catch(_0x57eee){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+'\x20message\x20json\x20parsing\x20error:\x20'+_0x57eee['message']+'\x20message:\x20'+_0x3b0b8d),_0x31290f[_0xf88169(0x259)]['debug'](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}const _0x1e1f47=_0x33ed57[_0xf88169(0x233)];if(!_0x1e1f47){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x1f2)+JSON[_0xf88169(0x23b)](_0x33ed57)),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}if(!_0x1e1f47['userName']){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x214)+JSON['stringify'](_0x33ed57)),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+'\x20done'+_0x429c50);return;}delete _0x1e1f47[_0xf88169(0x241)];let _0x507f88;_0x1e1f47['id']&&(_0x507f88=_0x1e1f47['id'],delete _0x1e1f47['id']);let _0x3375ab;_0x1e1f47[_0xf88169(0x235)]&&(_0x3375ab=utils[_0xf88169(0x220)](_0x1e1f47[_0xf88169(0x235)]),delete _0x1e1f47['onCreate']);await _0x51aadb(_0x1e1f47);const _0x4dcfe9=_0x1e1f47[_0xf88169(0x1ed)];let _0x26747f,_0x52508f;try{_0x26747f=await _0x232e97(_0xf88169(0x1ed),_0x4dcfe9);}catch(_0x14c5fd){_0x31290f['logger'][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x21d)+_0x14c5fd['message']),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}if(!_0x24a4cf[_0xf88169(0x21a)]){let _0x1557a5=![];if(_0x33ed57[_0xf88169(0x1f6)]&&Array[_0xf88169(0x224)](_0x33ed57[_0xf88169(0x1f6)]))for(let _0x141f3b=0x0;_0x141f3b<_0x33ed57[_0xf88169(0x1f6)]['length'];_0x141f3b++){const _0x56d25a=_0x33ed57[_0xf88169(0x1f6)][_0x141f3b];_0x56d25a[_0xf88169(0x218)]['startsWith']('roles')&&(_0x56d25a[_0xf88169(0x218)]=_0xf88169(0x275),Array[_0xf88169(0x224)](_0x56d25a[_0xf88169(0x28f)])?(_0x56d25a['value'][0x0]['id']=_0x56d25a['value'][0x0][_0xf88169(0x28f)],_0x56d25a[_0xf88169(0x28f)][0x0][_0xf88169(0x2a4)]=_0x56d25a[_0xf88169(0x28f)][0x0]['type']+_0xf88169(0x29c)+_0x56d25a['value'][0x0][_0xf88169(0x28f)],delete _0x56d25a[_0xf88169(0x28f)][0x0][_0xf88169(0x28f)],delete _0x56d25a[_0xf88169(0x28f)][0x0][_0xf88169(0x217)]):_0x56d25a[_0xf88169(0x28f)]=[{'id':_0x56d25a[_0xf88169(0x28f)],'display':_0x56d25a[_0xf88169(0x28f)]}],delete _0x56d25a['typeId'],_0x1557a5=!![]);}if(_0x1e1f47[_0xf88169(0x26c)]&&Array[_0xf88169(0x224)](_0x1e1f47['roles'])&&_0x1e1f47[_0xf88169(0x26c)]['length']>0x0){if(!_0x1e1f47[_0xf88169(0x275)])_0x1e1f47[_0xf88169(0x275)]=[];if(!Array[_0xf88169(0x224)](_0x1e1f47[_0xf88169(0x275)]))_0x1e1f47[_0xf88169(0x275)]=[];for(let _0x141def=0x0;_0x141def<_0x1e1f47['roles'][_0xf88169(0x280)];_0x141def++){const _0x4ad06e={},_0x4a7747=_0x1e1f47[_0xf88169(0x26c)][_0x141def];_0x4ad06e[_0xf88169(0x28f)]=_0x4a7747[_0xf88169(0x28f)],_0x4ad06e['display']=_0x4a7747[_0xf88169(0x217)]+_0xf88169(0x29c)+_0x4a7747[_0xf88169(0x2a4)],_0x1e1f47[_0xf88169(0x275)]['push'](_0x4ad06e);}delete _0x1e1f47[_0xf88169(0x26c)],_0x1557a5=!![];}if(_0x1557a5)_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x298)+JSON[_0xf88169(0x23b)](_0x33ed57));}if(!_0x26747f){if(_0x33ed57['activityOperation']==='deleteUser'){_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+'\x20Delete\x20User\x20userName='+_0x4dcfe9+_0xf88169(0x221)),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}if(_0x24a4cf[_0xf88169(0x29b)]&&_0x24a4cf[_0xf88169(0x29b)]===!![]){_0x31290f['logger'][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x22e)+_0x4dcfe9+'\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true'),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}if(Object[_0xf88169(0x27f)]['hasOwnProperty']['call'](_0x1e1f47,_0xf88169(0x27b))){if(typeof _0x1e1f47[_0xf88169(0x27b)]===_0xf88169(0x225)){const _0x2d5227=_0x1e1f47[_0xf88169(0x27b)][_0xf88169(0x21f)]();if(_0x2d5227===_0xf88169(0x1e8))_0x1e1f47['active']=!![];else{if(_0x2d5227===_0xf88169(0x2aa))_0x1e1f47[_0xf88169(0x27b)]=![];}}if(_0x1e1f47['active']===![]){_0x31290f['logger'][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x22e)+_0x4dcfe9+'\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false'),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}}_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x293)+_0x4dcfe9);const _0x211f3f=utils[_0xf88169(0x220)](_0x1e1f47);try{delete _0x211f3f['groups'];!_0x211f3f['password']&&_0x24a4cf[_0xf88169(0x1e5)]&&_0x24a4cf['generateUserPassword']===!![]&&(_0x211f3f[_0xf88169(0x20c)]=utils[_0xf88169(0x1eb)](0xf));if(_0x3375ab||_0x507f88){if(_0x3375ab)for(const _0x19952b in _0x3375ab){_0x211f3f[_0x19952b]=_0x3375ab[_0x19952b];}if(_0x507f88)_0x211f3f['id']=_0x507f88;await _0x51aadb(_0x211f3f);}await _0x31290f[_0xf88169(0x285)](_0x51705e,_0x211f3f),_0x1e1f47['groups']&&Array[_0xf88169(0x224)](_0x1e1f47[_0xf88169(0x275)])&&_0x1e1f47['groups'][_0xf88169(0x280)]>0x0&&(_0x52508f=await _0x232e97('userName',_0x4dcfe9));}catch(_0x3c734d){_0x31290f[_0xf88169(0x259)]['error'](_0x4efcda+_0xf88169(0x247)+JSON[_0xf88169(0x23b)](_0x211f3f)+_0xf88169(0x1f1)+_0x3c734d[_0xf88169(0x291)]+'}'),_0x31290f['logger']['debug'](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}}if(_0x26747f||_0x52508f){if(_0x33ed57[_0xf88169(0x23f)]===_0xf88169(0x278)){if(_0x24a4cf[_0xf88169(0x29b)]&&_0x24a4cf[_0xf88169(0x29b)]===!![]){_0x31290f['logger']['debug'](_0x4efcda+_0xf88169(0x26b)+_0x26747f+'\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true'),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x26b)+_0x26747f);try{await _0x31290f[_0xf88169(0x278)](_0x51705e,_0x26747f);}catch(_0x5c87cd){_0x31290f[_0xf88169(0x259)]['error'](_0x4efcda+_0xf88169(0x26b)+_0x26747f+'\x20error:\x20'+_0x5c87cd[_0xf88169(0x291)]+'}'),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+'\x20done'+_0x429c50);return;}}else{if(_0x52508f)_0x26747f=_0x52508f;_0x31290f['logger'][_0xf88169(0x240)](_0x4efcda+'\x20Replace\x20User\x20id='+_0x26747f);const _0x1896c9={};_0x1896c9[_0xf88169(0x237)]=()=>{},_0x1896c9[_0xf88169(0x269)]={},_0x1896c9['params'][_0xf88169(0x265)]=_0x51705e,_0x1896c9[_0xf88169(0x269)]['id']=_0x26747f,_0x1896c9[_0xf88169(0x296)]={},_0x1896c9[_0xf88169(0x296)][_0xf88169(0x27a)]=_0x51705e?'/'+_0x51705e+'/Users/'+_0x26747f:'/Users/'+_0x26747f,_0x1896c9['request']['body']=_0x1e1f47;try{await _0x31290f['replaceUsrGrp'](_0x1896c9);}catch(_0x271d62){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x266)+_0x26747f+_0xf88169(0x1f1)+_0x271d62['message']),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}if(_0x1896c9[_0xf88169(0x22a)]&&(_0x1896c9['status']<0xc8||_0x1896c9[_0xf88169(0x22a)]>0x12b)){if(_0x1896c9[_0xf88169(0x1ff)]){if(_0x1896c9[_0xf88169(0x1ff)][_0xf88169(0x23c)]){let _0x384ff7=_0x1896c9[_0xf88169(0x1ff)]['detail'];_0x384ff7=_0x384ff7[_0xf88169(0x28c)](_0x31290f['gwName']+'['+_0x31290f[_0xf88169(0x283)]+']',''+_0x4efcda),_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](''+_0x384ff7);}else{if(_0x1896c9[_0xf88169(0x1ff)][_0xf88169(0x274)]&&Array[_0xf88169(0x224)](_0x1896c9['body'][_0xf88169(0x274)])&&_0x1896c9[_0xf88169(0x1ff)][_0xf88169(0x274)][_0xf88169(0x280)]>0x0){let _0x3e935a=_0x1896c9[_0xf88169(0x1ff)][_0xf88169(0x274)][0x0]['description'];_0x3e935a=_0x3e935a['replace'](_0x31290f[_0xf88169(0x22f)]+'['+_0x31290f[_0xf88169(0x283)]+']',''+_0x4efcda),_0x31290f[_0xf88169(0x259)]['error'](''+_0x3e935a);}}}}if(_0x24a4cf[_0xf88169(0x271)]){const [_0x1eaacb,_0x1030d8]=_0x31290f[_0xf88169(0x254)]({'Operations':_0x33ed57[_0xf88169(0x1f6)]});if(_0x1030d8){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x266)+_0x26747f+_0xf88169(0x1ee)+_0x1030d8[_0xf88169(0x291)]),_0x31290f['logger'][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}const _0x5b10b1=[];if(_0x1eaacb['roles']&&Array['isArray'](_0x1eaacb[_0xf88169(0x26c)]))for(let _0x43d715=0x0;_0x43d715<_0x1eaacb[_0xf88169(0x26c)][_0xf88169(0x280)];_0x43d715++){_0x1eaacb[_0xf88169(0x26c)][_0x43d715]['operation']&&_0x1eaacb['roles'][_0x43d715][_0xf88169(0x295)]===_0xf88169(0x1fc)&&_0x5b10b1[_0xf88169(0x2a5)](_0x1eaacb['roles'][_0x43d715]);}if(_0x5b10b1[_0xf88169(0x280)]>0x0)try{await _0x31290f[_0xf88169(0x249)](_0x51705e,_0x26747f,{'roles':_0x5b10b1});}catch(_0x195383){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x266)+_0x26747f+'\x20role\x20removal\x20error:\x20'+_0x195383[_0xf88169(0x291)]);}const _0x301912=[];if(_0x1eaacb[_0xf88169(0x275)]&&Array[_0xf88169(0x224)](_0x1eaacb[_0xf88169(0x275)]))for(let _0x2f25dd=0x0;_0x2f25dd<_0x1eaacb[_0xf88169(0x275)][_0xf88169(0x280)];_0x2f25dd++){_0x1eaacb[_0xf88169(0x275)][_0x2f25dd][_0xf88169(0x295)]&&_0x1eaacb[_0xf88169(0x275)][_0x2f25dd]['operation']==='delete'&&_0x301912['push'](_0x1eaacb[_0xf88169(0x275)][_0x2f25dd]);}if(_0x301912[_0xf88169(0x280)]>0x0)for(let _0x396053=0x0;_0x396053<_0x301912['length'];_0x396053++){try{await _0x31290f[_0xf88169(0x204)](_0x51705e,_0x301912[_0x396053]['id'],{'members':[{'operation':_0xf88169(0x1fc),'value':_0x26747f}]});}catch(_0x15a696){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x4efcda+_0xf88169(0x266)+_0x26747f+_0xf88169(0x22c)+_0x15a696[_0xf88169(0x291)]);}}}if(_0x24a4cf[_0xf88169(0x2af)]&&_0x33ed57[_0xf88169(0x23f)]===_0xf88169(0x249)){if(_0x1e1f47[_0xf88169(0x275)]&&Array[_0xf88169(0x224)](_0x1e1f47[_0xf88169(0x275)])&&_0x1e1f47[_0xf88169(0x275)][_0xf88169(0x280)]===0x0){if(_0x1e1f47[_0xf88169(0x26c)]&&Array[_0xf88169(0x224)](_0x1e1f47[_0xf88169(0x26c)])&&_0x1e1f47[_0xf88169(0x26c)]['length']===0x0){if(_0x33ed57[_0xf88169(0x1f6)]&&Array['isArray'](_0x33ed57[_0xf88169(0x1f6)])&&_0x33ed57[_0xf88169(0x1f6)]['length']>0x0){let _0x583b27=![];for(let _0x428e7e=0x0;_0x428e7e<_0x33ed57[_0xf88169(0x1f6)][_0xf88169(0x280)];_0x428e7e++){const _0x2b9392=_0x33ed57[_0xf88169(0x1f6)][_0x428e7e];if(_0x2b9392['op']===_0xf88169(0x263)){if(_0x2b9392['path']){if(_0x2b9392[_0xf88169(0x218)][_0xf88169(0x1fe)]('roles')&&_0x2b9392[_0xf88169(0x2b1)]){_0x583b27=!![];break;}else{if(_0x2b9392[_0xf88169(0x218)]===_0xf88169(0x275)){_0x583b27=!![];break;}}}}}if(_0x583b27){_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x26b)+_0x26747f);try{await _0x31290f[_0xf88169(0x278)](_0x51705e,_0x26747f);}catch(_0x247788){_0x31290f['logger'][_0xf88169(0x205)](_0x4efcda+'\x20Delete\x20User\x20id='+_0x26747f+_0xf88169(0x1f1)+_0x247788[_0xf88169(0x291)]+'}'),_0x31290f[_0xf88169(0x259)][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);return;}}}}}}}}_0x31290f['logger'][_0xf88169(0x240)](_0x4efcda+_0xf88169(0x1e9)+_0x429c50);}catch(_0x37075a){_0x31290f[_0xf88169(0x259)][_0xf88169(0x205)](_0x31290f['gwName']+'['+_0x31290f[_0xf88169(0x283)]+_0xf88169(0x2a7)+_0x51705e+']['+_0x258328+']\x20error:\x20'+_0x37075a[_0xf88169(0x291)]+_0xf88169(0x21b)+_0x429c50);}},_0x3dafb7=nats[_0x20cb03(0x239)](),_0x2b30ae=_0x1266da[_0x20cb03(0x238)](),_0x18a1b9=(_0x20cb03(0x281)+_0x31290f[_0x20cb03(0x283)]+'_'+_0x51705e)['replaceAll']('*','#')['replaceAll']('>','##')['replaceAll']('.','_');let _0x10788e;const _0x38885d=async()=>{const _0x116fa7=_0x20cb03;try{const _0x312f4b=''+_0x24a4cf['nats'][_0x116fa7(0x1fd)],_0xcd2fde=await _0x1266da[_0x116fa7(0x299)](),_0x72c609=async()=>{const _0x52a0f8=_0x116fa7;let _0x27f1c2;try{_0x27f1c2=await _0x2b30ae['consumers'][_0x52a0f8(0x26a)](_0x312f4b,_0x18a1b9);}catch(_0x442dd2){await _0xcd2fde['consumers'][_0x52a0f8(0x231)](_0x312f4b,{'durable_name':_0x18a1b9,'ack_policy':nats[_0x52a0f8(0x213)]['Explicit'],'deliver_policy':nats[_0x52a0f8(0x28b)][_0x52a0f8(0x273)],'deliver_group':_0x24a4cf?.[_0x52a0f8(0x267)]?.['queueGroup']||null,'filter_subject':_0x258328}),_0x27f1c2=await _0x2b30ae[_0x52a0f8(0x22d)][_0x52a0f8(0x26a)](_0x312f4b,_0x18a1b9);}(_0x258328!==_0x27f1c2?.[_0x52a0f8(0x20e)]?.['config']?.[_0x52a0f8(0x1e0)]||_0x24a4cf?.[_0x52a0f8(0x267)]?.['queueGroup']!==_0x27f1c2?.[_0x52a0f8(0x20e)]?.[_0x52a0f8(0x284)]?.[_0x52a0f8(0x26f)])&&(await _0xcd2fde['consumers'][_0x52a0f8(0x276)](_0x312f4b,_0x18a1b9,{'deliver_group':_0x24a4cf?.[_0x52a0f8(0x267)]?.['queueGroup']||null,'filter_subject':_0x258328}),_0x27f1c2=await _0x2b30ae[_0x52a0f8(0x22d)]['get'](_0x312f4b,_0x18a1b9)),_0x10788e=await _0x27f1c2[_0x52a0f8(0x212)]({'max_messages':0x64});};await _0x72c609();const _0x547785=async()=>{const _0x2e8782=_0x116fa7;for await(const _0x443d0a of await _0x10788e[_0x2e8782(0x22a)]()){switch(_0x443d0a[_0x2e8782(0x217)]){case nats['ConsumerEvents'][_0x2e8782(0x25b)]:if(_0x443d0a['data']===0x1)_0x31290f[_0x2e8782(0x259)][_0x2e8782(0x251)](_0x31290f['gwName']+'['+_0x31290f[_0x2e8782(0x283)]+_0x2e8782(0x2a7)+_0x51705e+']['+_0x258328+_0x2e8782(0x2a6)+_0x443d0a[_0x2e8782(0x217)]),_0x72c609();else _0x443d0a[_0x2e8782(0x28e)]%0xa===0x0&&_0x31290f[_0x2e8782(0x259)][_0x2e8782(0x205)](_0x31290f[_0x2e8782(0x22f)]+'['+_0x31290f[_0x2e8782(0x283)]+_0x2e8782(0x2a7)+_0x51705e+']['+_0x258328+_0x2e8782(0x20a)+_0x443d0a[_0x2e8782(0x217)]+'\x20count='+_0x443d0a[_0x2e8782(0x28e)]);break;}}};_0x547785();for await(const _0x30f5aa of _0x10788e){if(!_0x30f5aa[_0x116fa7(0x1f9)]||!_0x30f5aa[_0x116fa7(0x1f9)][_0x116fa7(0x26a)](_0x116fa7(0x20f))){_0x30f5aa[_0x116fa7(0x28d)]();continue;}const _0x44095c=_0x31290f[_0x116fa7(0x22f)]+'['+_0x31290f['pluginName']+_0x116fa7(0x2a7)+_0x51705e+']['+_0x30f5aa['subject']+']['+_0x10788e[_0x116fa7(0x246)]()+']['+(_0x30f5aa[_0x116fa7(0x1f9)]?_0x30f5aa[_0x116fa7(0x1f9)][_0x116fa7(0x26a)]('Msg-Id'):'')+']',_0x244fba=_0x3dafb7[_0x116fa7(0x1e7)](_0x30f5aa[_0x116fa7(0x28e)]);await _0x4f4f80(_0x44095c,_0x244fba),_0x30f5aa['ack']();}}catch(_0x1dac28){_0x31290f[_0x116fa7(0x259)][_0x116fa7(0x205)](_0x31290f[_0x116fa7(0x22f)]+'['+_0x31290f['pluginName']+_0x116fa7(0x2a7)+_0x51705e+']['+_0x258328+_0x116fa7(0x1f7)+_0x1dac28['message']);}};_0x38885d();const _0x345736=async()=>{const _0x731d29=_0x20cb03;let _0x221f54=0x0;for await(const _0x24bd1f of _0x1266da[_0x731d29(0x22a)]()){switch(_0x24bd1f[_0x731d29(0x217)]){case nats[_0x731d29(0x209)]['Disconnect']:_0x31290f[_0x731d29(0x259)]['error'](_0x31290f[_0x731d29(0x22f)]+'['+_0x31290f[_0x731d29(0x283)]+_0x731d29(0x2a7)+_0x51705e+']['+_0x258328+_0x731d29(0x2b0)+_0x24bd1f['data']+_0x731d29(0x27d)),_0x221f54=0x0;break;case nats['Events'][_0x731d29(0x1df)]:_0x31290f[_0x731d29(0x259)]['info'](_0x31290f[_0x731d29(0x22f)]+'['+_0x31290f['pluginName']+_0x731d29(0x2a7)+_0x51705e+']['+_0x258328+_0x731d29(0x2ad)+_0x24bd1f['data']);try{if(_0x10788e['consumerInfo'])await _0x10788e[_0x731d29(0x242)]();}catch(_0x3f08fe){if(_0x10788e['unsubscribe'])_0x10788e[_0x731d29(0x262)]();}break;case nats[_0x731d29(0x209)]['Error']:_0x31290f[_0x731d29(0x259)][_0x731d29(0x205)](_0x31290f[_0x731d29(0x22f)]+'['+_0x31290f[_0x731d29(0x283)]+']\x20subscriber['+_0x51705e+']['+_0x258328+_0x731d29(0x250)+_0x24bd1f[_0x731d29(0x28e)]);break;case nats[_0x731d29(0x26d)][_0x731d29(0x255)]:_0x221f54+=0x1;_0x221f54%0x1e===0x0&&_0x31290f[_0x731d29(0x259)][_0x731d29(0x240)](_0x31290f[_0x731d29(0x22f)]+'['+_0x31290f[_0x731d29(0x283)]+_0x731d29(0x2a7)+_0x51705e+']['+_0x258328+']\x20client\x20is\x20attempting\x20to\x20reconnect\x20'+_0x24bd1f[_0x731d29(0x28e)]+_0x731d29(0x228)+_0x221f54+')');break;case nats[_0x731d29(0x26d)][_0x731d29(0x200)]:_0x31290f[_0x731d29(0x259)][_0x731d29(0x240)](_0x31290f[_0x731d29(0x22f)]+'['+_0x31290f[_0x731d29(0x283)]+']\x20subscriber['+_0x51705e+']['+_0x258328+_0x731d29(0x226)+_0x24bd1f['data']);break;}}};_0x345736(),process['on'](_0x20cb03(0x27e),async()=>{const _0x326904=_0x20cb03;_0x1266da&&await _0x1266da[_0x326904(0x1e4)]();}),process['on'](_0x20cb03(0x232),async()=>{const _0x3a7ef2=_0x20cb03;_0x1266da&&await _0x1266da[_0x3a7ef2(0x1e4)]();});};const _0x232e97=async(_0x41c62c,_0x41b7c4)=>{const _0x28ea8a=_0x5e4129,_0xec9984={'attribute':_0x41c62c,'operator':'eq','value':_0x41b7c4,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x43dd50=[_0x41c62c];if(_0x41c62c!=='id')_0x43dd50[_0x28ea8a(0x2a5)]('id');try{const _0x38786c=await _0x31290f[_0x28ea8a(0x1e6)](_0x51705e,_0xec9984,_0x43dd50);if(!_0x38786c||!_0x38786c['Resources']||!Array[_0x28ea8a(0x224)](_0x38786c[_0x28ea8a(0x236)]))throw new Error(_0x28ea8a(0x229)+JSON['stringify'](_0xec9984)+_0x28ea8a(0x24b));if(_0x38786c['Resources'][_0x28ea8a(0x280)]===0x0)return null;else{if(_0x38786c[_0x28ea8a(0x236)][_0x28ea8a(0x280)]>0x2)throw new Error(_0x28ea8a(0x229)+JSON['stringify'](_0xec9984)+_0x28ea8a(0x258));else{const _0x108243=_0x38786c[_0x28ea8a(0x236)][0x0];if(!_0x108243['id'])throw new Error('getUsers()\x20getObj='+JSON['stringify'](_0xec9984)+_0x28ea8a(0x223)+JSON[_0x28ea8a(0x23b)](_0x108243)+_0x28ea8a(0x206));return decodeURIComponent(_0x108243['id']);}}}catch(_0x285011){throw new Error(_0x28ea8a(0x229)+JSON['stringify'](_0xec9984)+'\x20error:\x20'+_0x285011[_0x28ea8a(0x291)]+'}');}},_0x42d99f=_0x5c0590=>{const _0x1ac6ba=_0x5e4129;if(!_0x5c0590||typeof _0x5c0590!==_0x1ac6ba(0x225))return[null,null];_0x5c0590=_0x5c0590['trim']();const _0x48ff6f=_0x5c0590[_0x1ac6ba(0x245)]('(');if(_0x48ff6f<0x1)return[null,null];if(_0x5c0590['substring'](_0x5c0590['length']-0x1)!==')')return[null,null];if(_0x5d71b4(_0x5c0590,'(')!==_0x5d71b4(_0x5c0590,')'))return[null,null];const _0x4a3ea2=_0x5c0590[_0x1ac6ba(0x252)](0x0,_0x48ff6f),_0x299ee3=_0x5c0590['substring'](_0x48ff6f+0x1,_0x5c0590[_0x1ac6ba(0x280)]-0x1);let _0x536f09=[];const _0x563185=_0x299ee3['split'](',');let _0xa588f4='';for(let _0x27d854=0x0;_0x27d854<_0x563185[_0x1ac6ba(0x280)];_0x27d854++){const _0x2fe8d4=_0xa588f4?_0xa588f4+','+_0x563185[_0x27d854]:_0x563185[_0x27d854],_0x29ee95=_0x5d71b4(_0x2fe8d4,'('),_0x23cbdf=_0x5d71b4(_0x2fe8d4,')');if(_0x29ee95===_0x23cbdf)_0x536f09[_0x1ac6ba(0x2a5)](_0x343cfa(_0x2fe8d4,'\x22')),_0xa588f4='';else{if(_0xa588f4)_0xa588f4+=','+_0x563185[_0x27d854];else _0xa588f4+=_0x563185[_0x27d854];}}if(_0x536f09[_0x1ac6ba(0x280)]===0x0)_0x536f09=null;return[_0x4a3ea2,_0x536f09];};function _0x5d71b4(_0x30fe47,_0x5d3faa){const _0xf8aa7a=_0x5e4129;let _0x4e3053=0x0;for(let _0x5ee553=0x0;_0x5ee553<_0x30fe47[_0xf8aa7a(0x280)];_0x5ee553++){_0x30fe47[_0xf8aa7a(0x2a3)](_0x5ee553)===_0x5d3faa&&(_0x4e3053+=0x1);}return _0x4e3053;}const _0x343cfa=(_0x396924,_0x49dd11)=>{const _0x15f980=_0x5e4129;if(typeof _0x396924!==_0x15f980(0x225)||typeof _0x49dd11!==_0x15f980(0x225))return _0x396924;if(_0x396924['length']===0x1)return _0x396924;if(_0x49dd11[_0x15f980(0x280)]!==0x1)return _0x396924;return _0x396924=_0x396924[_0x15f980(0x277)](),_0x396924[_0x15f980(0x252)](0x0,0x1)===_0x49dd11&&(_0x396924=_0x396924['substring'](0x1)),_0x396924[_0x15f980(0x252)](_0x396924['length']-0x1)===_0x49dd11&&(_0x396924=_0x396924[_0x15f980(0x252)](0x0,_0x396924['length']-0x1)),_0x396924;},_0x482484=async(_0x54f1e6,_0x18831e,_0x1833ba)=>{const _0x226b3c=_0x5e4129;if(!_0x54f1e6||!_0x18831e||!_0x1833ba)return null;const [_0x5f1885,_0x437507]=_0x42d99f(_0x1833ba);if(!_0x5f1885||!_0x437507){const _0x5bc0ea=_0x1833ba[_0x226b3c(0x290)]('(');if(_0x5bc0ea[_0x226b3c(0x280)]>0x1){const _0x29cef2=['lowercase','uppercase','firstn','elementnumber','join',_0x226b3c(0x28c),_0x226b3c(0x234),_0x226b3c(0x268),_0x226b3c(0x253)],_0x1831f7=_0x5bc0ea[0x0][_0x226b3c(0x21f)]();if(_0x29cef2['includes'](_0x1831f7))return null;}return _0x1833ba;}for(let _0x2dbf51=0x0;_0x2dbf51<_0x437507[_0x226b3c(0x280)];_0x2dbf51++){if(_0x437507[_0x2dbf51][_0x226b3c(0x252)](0x0,0x1)==='['){const _0x42fcfa=_0x437507[_0x2dbf51][_0x226b3c(0x245)](']');if(_0x42fcfa<0x0)return null;const _0x466c02=_0x437507[_0x2dbf51]['substring'](0x1,_0x42fcfa),_0xb181af=_0x466c02[_0x226b3c(0x290)]('.');let _0x39aa08;for(let _0x568eb3=0x0;_0x568eb3<_0xb181af[_0x226b3c(0x280)];_0x568eb3++){if(_0x568eb3===0x0)_0x39aa08=_0x54f1e6[_0xb181af[_0x568eb3]];else{if(!_0x39aa08)return null;_0x39aa08=_0x39aa08[_0xb181af[_0x568eb3]];}}if(!_0x39aa08)return null;_0x437507[_0x2dbf51]=_0x39aa08;}}for(let _0x10684a=0x0;_0x10684a<_0x437507['length'];_0x10684a++){const [_0xb518f3]=_0x42d99f(_0x437507[_0x10684a]);_0xb518f3&&(_0x437507[_0x10684a]=await _0x482484(_0x54f1e6,_0x18831e,_0x437507[_0x10684a]));}if(_0x437507[0x0]===null)return null;switch(_0x5f1885[_0x226b3c(0x21f)]()){case _0x226b3c(0x1f8):{if(_0x437507[_0x226b3c(0x280)]!==0x1)return null;const [_0x424a41]=_0x42d99f(_0x437507[0x0]);if(_0x424a41)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x424a41);if(_0x437507[0x0]===null)return null;return _0x437507[0x0]['toLowerCase']();}case _0x226b3c(0x20d):{if(_0x437507[_0x226b3c(0x280)]!==0x1)return null;const [_0x298c11]=_0x42d99f(_0x437507[0x0]);if(_0x298c11)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x298c11);if(_0x437507[0x0]===null)return null;return _0x437507[0x0][_0x226b3c(0x211)]();}case _0x226b3c(0x202):{if(_0x437507[_0x226b3c(0x280)]!==0x2)return null;const [_0x239820]=_0x42d99f(_0x437507[0x0]);if(_0x239820)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x239820);if(_0x437507[0x0]===null)return null;if(isNaN(_0x437507[0x1]))return null;return _0x437507[0x0][_0x226b3c(0x252)](0x0,_0x437507[0x1]);}case _0x226b3c(0x2ab):{const [_0x53eae3]=_0x42d99f(_0x437507[0x0]);if(_0x437507[_0x226b3c(0x280)]<0x2)return null;if(_0x53eae3)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x53eae3);if(_0x437507[0x0]===null)return null;const _0x552e86=_0x437507[0x1];if(isNaN(_0x552e86))return null;let _0x349266;if(_0x437507['length']===0x3)_0x349266=_0x437507[0x0][_0x226b3c(0x290)](_0x437507[0x2]);else _0x349266=_0x349266=_0x437507[0x0][_0x226b3c(0x290)]('\x20');if(_0x552e86<=_0x349266[_0x226b3c(0x280)])return _0x349266[_0x552e86-0x1];else return'';}case _0x226b3c(0x28c):{const [_0xc56ee2]=_0x42d99f(_0x437507[0x0]);if(_0xc56ee2)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0xc56ee2);if(_0x437507[0x0]===null)return null;if(_0x437507[_0x226b3c(0x280)]!==0x3)return null;return _0x437507[0x0][_0x226b3c(0x2a1)](_0x437507[0x1],_0x437507[0x2]);}case _0x226b3c(0x234):{if(_0x437507['length']!==0x1)return null;const [_0x9fbd70]=_0x42d99f(_0x437507[0x0]);if(_0x9fbd70)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x9fbd70);if(_0x437507[0x0]===null)return null;return ascii127[_0x226b3c(0x201)](_0x437507[0x0]);}case _0x226b3c(0x288):{let _0x5f3a1b='';for(let _0x4b5b72=0x0;_0x4b5b72<_0x437507[_0x226b3c(0x280)];_0x4b5b72++){const [_0x58cb75]=_0x42d99f(_0x437507[_0x4b5b72]);if(_0x58cb75)_0x437507[_0x4b5b72]=await _0x482484(_0x54f1e6,_0x18831e,_0x58cb75);if(_0x437507[_0x4b5b72]===null)return null;_0x5f3a1b+=_0x437507[_0x4b5b72];}return _0x5f3a1b;}case _0x226b3c(0x268):{if(_0x437507['length']>0x2)return null;const [_0x48bb93]=_0x42d99f(_0x437507[0x0]);if(_0x48bb93)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x48bb93);if(_0x437507[0x0]===null)return null;const _0x28206c=parseInt(_0x437507[0x0]);if(isNaN(_0x28206c))return null;let _0x3fa323=_0x226b3c(0x270);_0x3fa323+=','+_0x437507[0x0];if(_0x437507['length']===0x2&&_0x437507[0x1][_0x226b3c(0x21f)]()===_0x226b3c(0x1e8))_0x3fa323+=_0x226b3c(0x297);else _0x3fa323+=_0x226b3c(0x1e1);return _0x3fa323+='##',_0x3fa323;}case _0x226b3c(0x253):{if(_0x437507['length']!==0x1)return null;const [_0x3680e9]=_0x42d99f(_0x437507[0x0]);if(_0x3680e9)_0x437507[0x0]=await _0x482484(_0x54f1e6,_0x18831e,_0x3680e9);if(_0x437507[0x0]===null)return null;let _0x163755,_0x51f51c=![],_0x40ace9='';const _0x1c840d=_0x437507[0x0][_0x226b3c(0x290)]('##');if(_0x1c840d[_0x226b3c(0x280)]>0x2)for(let _0x3630de=0x0;_0x3630de<_0x1c840d[_0x226b3c(0x280)];_0x3630de++){if(_0x1c840d[_0x3630de][_0x226b3c(0x1fe)]('doIncrement')){const _0x374dbe=_0x1c840d[_0x3630de][_0x226b3c(0x290)](',');if(_0x374dbe[_0x226b3c(0x280)]<0x2)return null;const _0x466314=parseInt(_0x374dbe[0x1]);if(isNaN(_0x466314))return null;_0x40ace9='##'+_0x1c840d[_0x3630de]+'##',_0x163755=_0x374dbe[0x1],_0x374dbe[_0x226b3c(0x280)]>0x2&&(_0x51f51c=_0x374dbe[0x2][_0x226b3c(0x21f)]()==='true');}}let _0x1e30a4,_0xf3d579=0x0,_0x567d88=0x0;if(_0x163755){_0x567d88=_0x163755['length'],_0xf3d579=0xa;for(let _0x5df902=0x1;_0x5df902<_0x567d88;_0x5df902++){_0xf3d579*=0xa;}_0xf3d579-=0x1,_0x1e30a4=parseInt(_0x163755);if(isNaN(_0x1e30a4))return null;_0x1e30a4-=0x1;}else _0x1e30a4=0x0;do{_0x1e30a4+=0x1;let _0x555e37=_0x437507[0x0];if(_0x163755!==undefined&&_0x40ace9){let _0x230b98=_0x1e30a4[_0x226b3c(0x25f)]();while(_0x230b98[_0x226b3c(0x280)]<_0x567d88){_0x230b98='0'+_0x230b98;}_0x51f51c?_0x555e37=_0x555e37['replace'](_0x40ace9,_0x230b98):(_0x555e37=_0x555e37['replace'](_0x40ace9,''),_0x51f51c=!![],_0x1e30a4-=0x1);}try{const _0x804a9=await _0x232e97(_0x18831e,_0x555e37);if(!_0x804a9)return _0x555e37;}catch(_0x5aa613){return _0x31290f[_0x226b3c(0x259)][_0x226b3c(0x205)](_0x31290f[_0x226b3c(0x22f)]+'['+_0x31290f[_0x226b3c(0x283)]+']\x20'+_0x5f1885+_0x226b3c(0x21d)+_0x5aa613['message']),null;}}while(_0x1e30a4<_0xf3d579);return null;}default:}return null;},_0x51aadb=async _0x3464b4=>{const _0x21d9d1=_0x5e4129;for(const _0x105927 in _0x3464b4){const _0x6be27f=_0x3464b4[_0x105927],[_0x6a4c5a,_0x8ab459]=_0x42d99f(_0x6be27f);if(_0x6a4c5a){const _0x4e5d03=''+_0x105927,_0x1d1d99=_0x6a4c5a+'('+_0x8ab459[_0x21d9d1(0x288)](',')+')',_0x4bb400=await _0x482484(_0x3464b4,_0x4e5d03,_0x1d1d99);if(_0x4bb400===null)delete _0x3464b4[_0x105927];else _0x3464b4[_0x105927]=_0x4bb400;}for(const _0x2d95f7 in _0x6be27f){const _0x493b9e=_0x6be27f[_0x2d95f7],[_0x33deb9,_0x20659d]=_0x42d99f(_0x493b9e);if(_0x33deb9){const _0x18638c=_0x105927+'.'+_0x2d95f7,_0x599d0d=_0x33deb9+'('+_0x20659d[_0x21d9d1(0x288)](',')+')',_0x41bb18=await _0x482484(_0x3464b4,_0x18638c,_0x599d0d);if(_0x41bb18===null)delete _0x6be27f[_0x2d95f7];else _0x6be27f[_0x2d95f7]=_0x41bb18;}}}return _0x3464b4;};},module[a0_0x4938eb(0x230)][a0_0x4938eb(0x24a)]=async(_0x48f0ea,_0x12757e,_0x56a930,_0x2aadbc)=>{const _0xc3f8f0=a0_0x4938eb,_0x496103=_0xc3f8f0(0x24a),_0xb14446=_0x48f0ea;_0xb14446['logger'][_0xc3f8f0(0x240)](_0xb14446['gwName']+'['+_0xb14446['pluginName']+_0xc3f8f0(0x1ef)+_0x496103+'\x22');try{if(!fs['existsSync'](_0xb14446[_0xc3f8f0(0x292)]+_0xc3f8f0(0x1ea)))fs['mkdirSync'](_0xb14446['configDir']+_0xc3f8f0(0x1ea));}catch(_0x1926db){}const _0x35ac73=path['join'](''+_0xb14446['configDir'],'approles',_0xc3f8f0(0x248)+_0xb14446[_0xc3f8f0(0x283)]+_0xc3f8f0(0x2ae)),_0x458d3f={};utils[_0xc3f8f0(0x20b)](_0x35ac73)&&fs['readFileSync'](_0x35ac73,_0xc3f8f0(0x2a0))[_0xc3f8f0(0x290)](/\r?\n/)[_0xc3f8f0(0x29f)](_0x3d2842=>{const _0x34d309=_0xc3f8f0,_0x1233ea=_0x3d2842['split']('\x20');_0x1233ea[_0x34d309(0x280)]===0x2&&(_0x458d3f[_0x1233ea[0x0]]=_0x1233ea[0x1]);});const _0x42d37e=fs[_0xc3f8f0(0x256)](_0x35ac73,{'flags':'w','encoding':_0xc3f8f0(0x1e2),'mode':0x1b6,'autoClose':!![]}),_0x544153=[],_0x288dd9=await _0xb14446[_0xc3f8f0(0x1ec)](_0x12757e,{'attribute':undefined,'operator':undefined,'value':undefined},['id','displayName']);return _0x288dd9[_0xc3f8f0(0x236)]['forEach'](_0x3b379b=>{const _0xd4c35e=_0xc3f8f0;if(_0x3b379b['id']){let _0x552cb1=crypto[_0xd4c35e(0x207)]();if(_0x458d3f[_0x3b379b['id']])_0x552cb1=_0x458d3f[_0x3b379b['id']];const _0x452090={'allowedMemberTypes':['User'],'description':'SCIM\x20Stream\x20-\x20Autogenerated','displayName':_0x3b379b[_0xd4c35e(0x25e)]||_0x3b379b['id'],'id':_0x552cb1,'isEnabled':!![],'lang':null,'origin':_0xd4c35e(0x257),'value':decodeURIComponent(_0x3b379b['id'])};_0x544153[_0xd4c35e(0x2a5)](_0x452090),_0x42d37e[_0xd4c35e(0x25a)](_0x3b379b['id']+'\x20'+_0x552cb1+'\x0a');}}),_0x42d37e[_0xc3f8f0(0x1f3)](),_0xb14446['logger']['debug'](_0xb14446['gwName']+'['+_0xb14446['pluginName']+_0xc3f8f0(0x26e)+_0x35ac73),{'Resources':[{'appRoles':_0x544153}]};};
@@ -1207,6 +1207,7 @@ const ScimGateway = function () {
1207
1207
  }
1208
1208
  delete jsonBody.password
1209
1209
  jsonBody = addPrimaryAttrs(jsonBody)
1210
+ jsonBody = addSchemas(jsonBody, handle.description, isScimv2)
1210
1211
  ctx.status = 201
1211
1212
  ctx.body = jsonBody
1212
1213
  } catch (err) {
@@ -1367,9 +1368,9 @@ const ScimGateway = function () {
1367
1368
  u = u.substr(u.lastIndexOf('/') + 1) // u = Users, Groups
1368
1369
  const handle = handler[u]
1369
1370
  const id = ctx.params.id
1370
- const jsonBody = ctx.request.body
1371
- const strBody = JSON.stringify(jsonBody)
1372
- if (strBody === '{}' || !handle) {
1371
+ const obj = ctx.request.body
1372
+ const strObj = JSON.stringify(obj)
1373
+ if (strObj === '{}' || !handle) {
1373
1374
  ctx.status = 500
1374
1375
  const err = new Error('malformatted PUT requests')
1375
1376
  const [e, customErrorCode] = jsonErr(config.scim.version, pluginName, ctx.status, err)
@@ -1377,12 +1378,11 @@ const ScimGateway = function () {
1377
1378
  ctx.body = e
1378
1379
  return
1379
1380
  }
1380
- logger.debug(`${gwName}[${pluginName}] PUT ${ctx.request.originalUrl} body=${strBody}`)
1381
+ logger.debug(`${gwName}[${pluginName}] PUT ${ctx.request.originalUrl} body=${strObj}`)
1381
1382
  try {
1382
1383
  // get current object
1383
1384
  logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
1384
1385
  let res = await this[handle.getMethod](ctx.params.baseEntity, { attribute: 'id', operator: 'eq', value: id }, [], ctx.ctxCopy)
1385
-
1386
1386
  let currentObj
1387
1387
  if (res && res.Resources && Array.isArray(res.Resources)) {
1388
1388
  if (res.Resources.length === 1) currentObj = res.Resources[0]
@@ -1400,78 +1400,26 @@ const ScimGateway = function () {
1400
1400
  return
1401
1401
  }
1402
1402
 
1403
- let clearedObj = {}
1404
- if (config.scim.usePutSoftSync) { // usePutSoftSync=true keeps eksisting attributes (and groups) that are not included in PUT jsonBody
1405
- const tmpObj = {}
1406
- for (const key in currentObj) { // only include arrays in clearedObj and later on remove those in newObj having operation delete
1407
- if (Array.isArray(currentObj[key])) {
1408
- tmpObj[key] = currentObj[key]
1409
- }
1410
- }
1411
- if (Object.keys(tmpObj).length > 0) {
1412
- clearedObj = clearObjectValues(tmpObj)
1413
- }
1414
- } else {
1415
- clearedObj = clearObjectValues(currentObj)
1416
- delete clearedObj.active
1417
- delete clearedObj.password
1418
- delete clearedObj.meta
1419
- }
1420
- if (config.scim.usePutGroupMemberOfUser) { // group member of user instead of default user member of group
1421
- if (clearedObj.groups && Array.isArray(clearedObj.groups)) {
1422
- for (let i = 0; i < clearedObj.groups.length; i++) {
1423
- if (clearedObj.groups[i].operation && clearedObj.groups[i].operation === 'delete') {
1424
- clearedObj.groups.splice(i, 1) // delete
1425
- i -= 1
1426
- }
1427
- }
1428
- }
1403
+ const activeExists = Object.prototype.hasOwnProperty.call(obj, 'active')
1404
+ let objGroups
1405
+ if (obj.groups) {
1406
+ objGroups = utils.copyObj(obj.groups)
1407
+ if (!config.scim.usePutGroupMemberOfUser) delete obj.groups
1429
1408
  }
1430
- // merge cleared object with the new
1431
- const newObj = utils.extendObj(clearedObj, jsonBody)
1432
- delete newObj.id
1433
- delete newObj.schemas
1434
- delete newObj.meta
1435
- if (!config.scim.usePutGroupMemberOfUser) delete newObj.groups
1436
- for (const key in newObj) {
1437
- if (Array.isArray(newObj[key])) {
1438
- if (config.scim.usePutSoftSync) {
1439
- const arr = newObj[key]
1440
- for (let i = 0; i < arr.length; i++) {
1441
- if (arr[i]?.operation === 'delete') {
1442
- arr.splice(i, 1) // delete
1443
- i -= 1
1444
- }
1445
- }
1446
- }
1447
- if (newObj[key].length === 0) {
1448
- delete newObj[key]
1449
- }
1450
- } else {
1451
- if (typeof (newObj[key]) === 'object') {
1452
- for (const keySub in newObj[key]) {
1453
- if (typeof (newObj[key][keySub]) === 'object') {
1454
- for (const keySubSub in newObj[key][keySub]) {
1455
- if (currentObj[key] && currentObj[key][keySub] && currentObj[key][keySub][keySubSub] === newObj[key][keySub][keySubSub]) {
1456
- delete newObj[key][keySub][keySubSub]
1457
- }
1458
- }
1459
- if (Object.keys(newObj[key][keySub]).length === 0) delete newObj[key][keySub]
1460
- } else {
1461
- if (currentObj[key] && currentObj[key][keySub] === newObj[key][keySub]) {
1462
- delete newObj[key][keySub]
1463
- }
1464
- }
1465
- }
1466
- if (Object.keys(newObj[key]).length === 0) delete newObj[key]
1467
- } else if (newObj[key] === currentObj[key]) delete newObj[key]
1468
- }
1469
- }
1470
- // not allowing userName/displayName set to blank
1471
- if (!newObj.userName) delete newObj.userName
1472
- if (!newObj.displayName) delete newObj.displayName
1473
1409
 
1474
- let [scimdata, err] = ScimGateway.prototype.convertedScim(newObj)
1410
+ // merge obj with currentObj as cleared
1411
+ utils.extendObjClear(obj, currentObj, config.scim.usePutSoftSync)
1412
+ delete obj.id
1413
+ delete obj.schemas
1414
+ delete obj.meta
1415
+ if (!activeExists && !config.scim.usePutSoftSync) delete obj.active
1416
+ // remove from obj what match currentObj
1417
+ utils.deltaObj(obj, currentObj)
1418
+ // userName/displayName should not be set to blank
1419
+ if (!obj.userName) delete obj.userName
1420
+ if (!obj.displayName && handle.modifyMethod === 'modifyGroup') delete obj.displayName
1421
+
1422
+ let [scimdata, err] = ScimGateway.prototype.convertedScim(obj)
1475
1423
  if (err) throw err
1476
1424
 
1477
1425
  // update object
@@ -1482,7 +1430,7 @@ const ScimGateway = function () {
1482
1430
 
1483
1431
  // add/remove groups
1484
1432
  if (!config.scim.usePutGroupMemberOfUser) { // default user member of group
1485
- if (jsonBody.groups && Array.isArray(jsonBody.groups)) { // only if groups included, { "groups": [] } will remove all existing
1433
+ if (objGroups && Array.isArray(objGroups)) { // only if groups included, { "groups": [] } will remove all existing
1486
1434
  if (typeof this[handler.groups.getMethod] !== 'function' || typeof this[handler.groups.modifyMethod] !== 'function') {
1487
1435
  throw new Error('replaceUser error: put operation can not be fully completed for the user`s groups, methods like getGroups() and modifyGroup() are not implemented')
1488
1436
  }
@@ -1514,25 +1462,25 @@ const ScimGateway = function () {
1514
1462
  const addGrps = []
1515
1463
  const removeGrps = []
1516
1464
  // add
1517
- for (let i = 0; i < jsonBody.groups.length; i++) {
1518
- if (!jsonBody.groups[i].value) continue
1519
- jsonBody.groups[i].value = decodeURIComponent(jsonBody.groups[i].value)
1465
+ for (let i = 0; i < objGroups.length; i++) {
1466
+ if (!objGroups[i].value) continue
1467
+ objGroups[i].value = decodeURIComponent(objGroups[i].value)
1520
1468
  let found = false
1521
1469
  for (let j = 0; j < currentGroups.length; j++) {
1522
- if (jsonBody.groups[i].value === currentGroups[j].value) {
1470
+ if (objGroups[i].value === currentGroups[j].value) {
1523
1471
  found = true
1524
1472
  break
1525
1473
  }
1526
1474
  }
1527
- if (!found && jsonBody.groups[i].value) addGrps.push(jsonBody.groups[i].value)
1475
+ if (!found && objGroups[i].value) addGrps.push(objGroups[i].value)
1528
1476
  }
1529
1477
  // remove
1530
1478
  for (let i = 0; i < currentGroups.length; i++) {
1531
1479
  let found = false
1532
- for (let j = 0; j < jsonBody.groups.length; j++) {
1533
- if (!jsonBody.groups[j].value) continue
1534
- jsonBody.groups[j].value = decodeURIComponent(jsonBody.groups[j].value)
1535
- if (currentGroups[i].value === jsonBody.groups[j].value) {
1480
+ for (let j = 0; j < objGroups.length; j++) {
1481
+ if (!objGroups[j].value) continue
1482
+ objGroups[j].value = decodeURIComponent(objGroups[j].value)
1483
+ if (currentGroups[i].value === objGroups[j].value) {
1536
1484
  found = true
1537
1485
  break
1538
1486
  }
@@ -3060,37 +3008,6 @@ ScimGateway.prototype.convertedScim20 = function convertedScim20 (obj) {
3060
3008
  return ScimGateway.prototype.convertedScim(scimdata)
3061
3009
  }
3062
3010
 
3063
- //
3064
- // clearObjectValues returns a new object having values set to blank
3065
- // array values are kept, but includes {"operation" : "delete"} - scim 1.1 formatted
3066
- // boolean values e.g. {"active" : true} are kept "as is"
3067
- // parent used for internal recursive logic
3068
- const clearObjectValues = (o, parent) => {
3069
- if (!o) return {}
3070
- let v, key
3071
- const output = Object.getPrototypeOf(o) === Object.getPrototypeOf([]) ? [] : {}
3072
- for (key in o) {
3073
- v = o[key]
3074
- if (typeof v === 'object' && v !== null) {
3075
- const objProp = Object.getPrototypeOf(v)
3076
- if (objProp !== null && objProp !== Object.getPrototypeOf({}) && objProp !== Object.getPrototypeOf([])) {
3077
- output[key] = Object.assign(Object.create(v), v)
3078
- } else {
3079
- output[key] = clearObjectValues(v, key)
3080
- }
3081
- } else {
3082
- if (parent && !isNaN(parent)) { // array
3083
- output.operation = 'delete'
3084
- output[key] = v
3085
- } else {
3086
- if (typeof v === 'boolean') output[key] = v
3087
- else output[key] = ''
3088
- }
3089
- }
3090
- }
3091
- return output
3092
- }
3093
-
3094
3011
  //
3095
3012
  // SCIM error formatting
3096
3013
  //
package/lib/utils.js CHANGED
@@ -200,19 +200,33 @@ const extendObj = (obj, src) => {
200
200
  for (let i = 0; i < src[key].length; i++) {
201
201
  const val = src[key][i]
202
202
  if (typeof val === 'object') {
203
- if (Object.prototype.hasOwnProperty.call(val, 'value')) {
204
- const arr = obj[key].filter((el, index) => {
205
- if (el.value && el.value === val.value & el.type === val.type) {
206
- if (el.operation === 'delete' && !val.operation) obj[key].splice(index, 1) // delete
207
- return true
208
- } else if (el.value === '' && el.operation === 'delete' && el.type && el.type === val.type) {
209
- obj[key].splice(index, 1) // delete
210
- return false
203
+ if (Object.prototype.hasOwnProperty.call(val, 'type')) {
204
+ if (!obj[key]) obj[key] = [val]
205
+ else {
206
+ for (let j = 0; j < obj[key].length; j++) {
207
+ const el = obj[key][j]
208
+ if (el.type === val.type) {
209
+ obj[key].splice(j, 1)
210
+ j -= 1
211
+ break
212
+ }
211
213
  }
212
- return false
213
- })
214
- if (arr.length < 1) obj[key].push(val)
215
- } else obj[key].push(val)
214
+ obj[key].push(val)
215
+ }
216
+ } else if (Object.prototype.hasOwnProperty.call(val, 'value')) {
217
+ if (!obj[key]) obj[key] = [val]
218
+ else {
219
+ for (let j = 0; j < obj[key].length; j++) {
220
+ const el = obj[key][j]
221
+ if (el.value === val.value) {
222
+ obj[key].splice(j, 1)
223
+ j -= 1
224
+ break
225
+ }
226
+ }
227
+ obj[key].push(val)
228
+ }
229
+ }
216
230
  } else if (!obj[key].includes(val)) obj[key].push(val)
217
231
  }
218
232
  }
@@ -227,7 +241,173 @@ module.exports.extendObj = (obj, src) => { // copy src content into obj
227
241
  return extendObj(obj, src)
228
242
  }
229
243
 
230
- module.exports.stripObj = (obj, attributes, excludedAttributes) => { // strip and return a new object according to attributes or excludedAttributes - comma separated dot object list
244
+ // extendObjClear extends obj with cleared src
245
+ // if isSoftSync, extend without cleared
246
+ module.exports.extendObjClear = (obj, src, isSoftSync) => {
247
+ Object.keys(src).forEach((key) => {
248
+ if (src[key] === null) return
249
+ if (typeof src[key] !== 'object') { // last key
250
+ if (Object.prototype.hasOwnProperty.call(obj, key)) return
251
+ if (isSoftSync) obj[key] = src[key]
252
+ else {
253
+ switch (typeof src[key]) {
254
+ case 'string':
255
+ obj[key] = ''
256
+ break
257
+ case 'boolean':
258
+ obj[key] = false
259
+ break
260
+ case 'number':
261
+ obj[key] = 0
262
+ break
263
+ default:
264
+ obj[key] = ''
265
+ }
266
+ }
267
+ return
268
+ }
269
+
270
+ if (!Array.isArray(src[key])) {
271
+ if (!obj[key]) obj[key] = {}
272
+ obj[key] = module.exports.extendObjClear(obj[key], src[key], isSoftSync)
273
+ } else { // array
274
+ if (!Array.isArray(obj[key])) obj[key] = []
275
+ for (let i = 0; i < src[key].length; i++) {
276
+ const val = src[key][i]
277
+ if (typeof val !== 'object') {
278
+ if (!obj[key].includes(val)) obj[key].push(val) // e.g. ["value1", "value2"]
279
+ } else {
280
+ if (Object.prototype.hasOwnProperty.call(val, 'type')) {
281
+ if (obj[key].length < 1) {
282
+ const v = this.copyObj(val)
283
+ if (!isSoftSync) v.operation = 'delete'
284
+ obj[key].push(v)
285
+ } else {
286
+ let found = false
287
+ for (const k in obj[key]) {
288
+ const el = obj[key][k]
289
+ if (el.type === val.type) {
290
+ found = true
291
+ for (const kv in val) {
292
+ if (kv === 'type' || kv === 'value' || isSoftSync) continue // don't clear type/value
293
+ if (Object.prototype.hasOwnProperty.call(el, kv)) continue
294
+ switch (typeof val[kv]) {
295
+ case 'string':
296
+ el[kv] = ''
297
+ break
298
+ case 'boolean':
299
+ el[kv] = false
300
+ break
301
+ case 'number':
302
+ el[kv] = 0
303
+ break
304
+ default:
305
+ el[kv] = ''
306
+ }
307
+ }
308
+ }
309
+ }
310
+ if (!found) {
311
+ const v = module.exports.copyObj(val)
312
+ if (!isSoftSync) v.operation = 'delete'
313
+ obj[key].push(v)
314
+ }
315
+ }
316
+ } else if (Object.prototype.hasOwnProperty.call(val, 'value')) { // no type
317
+ if (obj[key].length < 1) {
318
+ const v = module.exports.copyObj(val)
319
+ if (!isSoftSync) v.operation = 'delete'
320
+ obj[key].push(v)
321
+ } else {
322
+ const addArr = []
323
+ for (let j = 0; j < obj[key].length; j++) {
324
+ const el = obj[key][j]
325
+ if (el.value === val.value) {
326
+ obj[key].splice(j, 1)
327
+ j -= 1
328
+ } else {
329
+ const v = module.exports.copyObj(val)
330
+ if (!isSoftSync) v.operation = 'delete'
331
+ addArr.push(v)
332
+ }
333
+ }
334
+ if (addArr.length > 0) {
335
+ obj[key] = [...obj[key], ...addArr]
336
+ }
337
+ }
338
+ } else {
339
+ obj[key].push(val)
340
+ }
341
+ }
342
+ }
343
+ }
344
+ })
345
+ return obj // recursive
346
+ }
347
+
348
+ // deltaObj removes from obj what matches with src, only delta remains in obj
349
+ module.exports.deltaObj = (obj, src) => {
350
+ for (const key in obj) {
351
+ if (Array.isArray(obj[key])) {
352
+ if (!src[key] || !Array.isArray(src[key])) continue
353
+ const arr = obj[key]
354
+ for (let i = 0; i < arr.length; i++) {
355
+ const el = arr[i]
356
+ if (el.operation) continue // keep operation
357
+ if (el.type) {
358
+ if (Object.prototype.hasOwnProperty.call(el, 'value')) {
359
+ const a = src[key].filter(o => o.type === el.type && o.value === el.value)
360
+ if (a.length === 1) {
361
+ arr.splice(i, 1)
362
+ i -= 1
363
+ }
364
+ } else { // only type
365
+ const a = src[key].filter(o => {
366
+ for (const k in el) {
367
+ if (el[k] !== o[k]) return false
368
+ }
369
+ return true
370
+ })
371
+ if (a.length === 1) {
372
+ arr.splice(i, 1)
373
+ i -= 1
374
+ }
375
+ }
376
+ } else if (Object.prototype.hasOwnProperty.call(el, 'value')) {
377
+ const a = src[key].filter(o => o.value === el.value)
378
+ if (a.length === 1) {
379
+ arr.splice(i, 1)
380
+ i -= 1
381
+ }
382
+ }
383
+ }
384
+ if (arr.length === 0) {
385
+ delete obj[key]
386
+ }
387
+ } else {
388
+ if (typeof (obj[key]) === 'object') {
389
+ for (const keySub in obj[key]) {
390
+ if (typeof (obj[key][keySub]) === 'object') {
391
+ for (const keySubSub in obj[key][keySub]) {
392
+ if (src[key] && src[key][keySub] && src[key][keySub][keySubSub] === obj[key][keySub][keySubSub]) {
393
+ delete obj[key][keySub][keySubSub]
394
+ }
395
+ }
396
+ if (Object.keys(obj[key][keySub]).length === 0) delete obj[key][keySub]
397
+ } else {
398
+ if (src[key] && src[key][keySub] === obj[key][keySub]) {
399
+ delete obj[key][keySub]
400
+ }
401
+ }
402
+ }
403
+ if (Object.keys(obj[key]).length === 0) delete obj[key]
404
+ } else if (obj[key] === src[key]) delete obj[key]
405
+ }
406
+ }
407
+ }
408
+
409
+ // stripObj strips and return a new object according to attributes or excludedAttributes - comma separated dot object list
410
+ module.exports.stripObj = (obj, attributes, excludedAttributes) => {
231
411
  if (!attributes && !excludedAttributes) return obj
232
412
  if (!obj || typeof obj !== 'object') return obj
233
413
  let arrObj
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "4.4.5",
3
+ "version": "4.4.6",
4
4
  "description": "Using SCIM protocol as a gateway for user provisioning to other endpoints",
5
5
  "author": "Jarle Elshaug <jarle.elshaug@gmail.com> (https://elshaug.xyz)",
6
6
  "homepage": "https://elshaug.xyz",