@brown-ds/distribution 0.2.24 → 0.2.26

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.
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g.js');function getNode(_0x4a8d46,_0x69ce06,_0x429d12){const _0x2e769a=_0x69ce06&&typeof _0x69ce06==='object'?_0x69ce06['key']:_0x69ce06;globalThis['distributi'+'on'][_0x4a8d46['gid']]['status']['get']('nid',(_0x227145,_0x3868c7)=>{const _0x89a799=Object['values'](_0x3868c7),_0x451438=globalThis['distributi'+'on']['util']['id']['getID'](_0x2e769a),_0x50335a=_0x4a8d46['hash'](_0x451438,_0x89a799),_0x5a0ed3=_0x50335a['substring'](-0x1*-0x1877+0xca*-0x2e+0xbd5,-0x2*-0x761+0x2645+-0xa*0x54d);globalThis['distributi'+'on']['local']['groups']['get'](_0x4a8d46['gid'],(_0x44541b,_0x2883e1)=>{if(!_0x2883e1)return _0x429d12(_0x44541b);else{const _0x503ee8=_0x2883e1[_0x5a0ed3];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x69ce06)+'group:\x20'+JSON['stringify'](_0x2883e1)+'\x20node:\x20'+JSON['stringify'](_0x503ee8)+'nid:\x20'+JSON['stringify'](_0x50335a)+'\x20sid:\x20'+JSON['stringify'](_0x5a0ed3)),_0x429d12(null,_0x503ee8);}});});}function normalize(_0x4f03d4,_0x4a86b1){if(_0x4f03d4===null)return{'key':null,'gid':_0x4a86b1,'action':'put'};else return typeof _0x4f03d4==='string'?{'key':_0x4f03d4,'gid':_0x4a86b1,'action':'put'}:_0x4f03d4;}function store(_0x3c5d4c){const _0x32a4f3={'gid':_0x3c5d4c['gid']||'all','hash':_0x3c5d4c['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'],'subset':_0x3c5d4c['subset']};function _0x538f96(_0x45cd96,_0x4956dd){if(!_0x45cd96){const _0x38c459=[{'key':null,'gid':_0x32a4f3['gid']}];globalThis['distributi'+'on'][_0x32a4f3['gid']]['comm']['send'](_0x38c459,{'service':'store','method':'get'},(_0x5679d2,_0x140eb9)=>{const _0xb9d483=Object['values'](_0x140eb9)['reduce']((_0x43cfdd,_0x241f61)=>_0x43cfdd['concat'](_0x241f61),[]);_0x4956dd(_0x5679d2,_0xb9d483);});return;}_0x45cd96=normalize(_0x45cd96,_0x32a4f3['gid']),getNode(_0x32a4f3,_0x45cd96,(_0xbe761,_0x31a46c)=>{if(!_0x31a46c){_0x4956dd(_0xbe761);return;}const _0xf768bf=[_0x45cd96],_0x46a88a={'service':'store','method':'get','node':_0x31a46c};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x45cd96)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x31a46c)),globalThis['distributi'+'on']['local']['comm']['send'](_0xf768bf,_0x46a88a,_0x4956dd);});return;return _0x4956dd(new Error('store.get\x20'+'not\x20implem'+'ented'));}function _0x159653(_0x6e0b54,_0x42600f,_0xfabe01){_0x42600f=_0x42600f||globalThis['distributi'+'on']['util']['id']['getID'](_0x6e0b54),_0x42600f=normalize(_0x42600f,_0x32a4f3['gid']),getNode(_0x32a4f3,_0x42600f,(_0x3c46a7,_0x515ab7)=>{if(!_0x515ab7){_0xfabe01(_0x3c46a7);return;}const _0x49acb7=[_0x6e0b54,_0x42600f],_0x5bbffe={'service':'store','method':'put','node':_0x515ab7};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x6e0b54)+('configurat'+'ion:\x20')+JSON['stringify'](_0x42600f)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x515ab7)),globalThis['distributi'+'on']['local']['comm']['send'](_0x49acb7,_0x5bbffe,_0xfabe01);});return;return _0xfabe01(new Error('store.put\x20'+'not\x20implem'+'ented'));}function _0xf7d730(_0x4d9055,_0x450d71){getNode(_0x32a4f3,_0x4d9055,(_0x3925de,_0x3fc873)=>{if(!_0x3fc873){_0x450d71(_0x3925de);return;}const _0x583da3=[{'key':_0x4d9055,'gid':_0x32a4f3['gid']}],_0x5e7a35={'service':'store','method':'del','node':_0x3fc873};globalThis['distributi'+'on']['local']['comm']['send'](_0x583da3,_0x5e7a35,_0x450d71);});return;return _0x450d71(new Error('store.del\x20'+'not\x20implem'+'ented'));}function _0x4b959b(_0x38686d,_0x121ecb){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x38686d)+'\x20gid:\x20'+_0x32a4f3['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x32a4f3['gid'],(_0x225c6f,_0x5de63b)=>{if(!_0x5de63b){_0x121ecb(_0x225c6f);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x32a4f3['gid'],_0x38686d,(_0x5df20d,_0x5a62ec)=>{globalThis['distributi'+'on'][_0x32a4f3['gid']]['store']['get'](null,(_0x1f31ca,_0x182920)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x32a4f3['gid'],_0x5de63b,(_0x20d543,_0x2e150d)=>{globalThis['distributi'+'on'][_0x32a4f3['gid']]['status']['get']('nid',(_0x1e7bbe,_0x1c803c)=>{const _0x5b39f7=Object['values'](_0x1c803c),_0x277cda=Object['values'](_0x38686d)['map'](_0x564e64=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x564e64));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x182920['length']+('\x20keys\x20from'+'\x20')+_0x1c803c['length']+'\x20nodes');let _0x2b30dd=0xd*0x137+-0x1716*-0x1+-0x26e1*0x1;const _0x2b7316=()=>{if(_0x2b30dd===_0x182920['length'])return _0x121ecb(null);};if(_0x182920['length']===0x1b8+-0x2633+0x247b)return _0x121ecb(null);for(const _0x563df6 of _0x182920){const _0x3b337f=globalThis['distributi'+'on']['util']['id']['getID'](_0x563df6),_0x934556=_0x32a4f3['hash'](_0x3b337f,_0x277cda),_0x2bbe23=_0x32a4f3['hash'](_0x3b337f,_0x5b39f7);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x934556+'\x20new\x20nid:\x20'+_0x2bbe23);if(_0x934556===_0x2bbe23){_0x2b30dd++,_0x2b7316();continue;}const _0x6e94e9=_0x38686d[_0x934556['substring'](0x477*-0x1+0x18cc+-0x1455,0x1d95*0x1+-0x22a*0x6+0x1*-0x1094)],_0x3eee67=[{'key':_0x563df6,'gid':_0x32a4f3['gid']}],_0x34de30={'service':'store','method':'del','node':_0x6e94e9};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x563df6+'\x20from\x20'+JSON['stringify'](_0x34de30)),globalThis['distributi'+'on']['local']['comm']['send'](_0x3eee67,_0x34de30,(_0x4f5509,_0x57fd82)=>{globalThis['distributi'+'on'][_0x32a4f3['gid']]['store']['put'](_0x57fd82,_0x563df6,(_0x41d067,_0x4c93c7)=>{_0x2b30dd++,_0x2b7316();});});}});});});});});return;return _0x121ecb(new Error('store.reco'+'nf\x20not\x20imp'+'lemented'));}return{'get':_0x538f96,'put':_0x159653,'del':_0xf7d730,'reconf':_0x4b959b};}module['exports']=store;
9
+ const log=require('../util/lo'+'g.js');function getNode(_0x1de661,_0x24d5f0,_0x28af9d){const _0x15363d=_0x24d5f0&&typeof _0x24d5f0==='object'?_0x24d5f0['key']:_0x24d5f0;globalThis['distributi'+'on'][_0x1de661['gid']]['status']['get']('nid',(_0x3dd193,_0x1b7cfb)=>{const _0x285dc5=Object['values'](_0x1b7cfb),_0x453505=globalThis['distributi'+'on']['util']['id']['getID'](_0x15363d),_0x1d2a3f=_0x1de661['hash'](_0x453505,_0x285dc5),_0x1a412c=_0x1d2a3f['substring'](0x46*-0xe+-0xa*-0xc4+-0x3d4,-0x1ef7+-0x1fd5+-0x3ed1*-0x1);globalThis['distributi'+'on']['local']['groups']['get'](_0x1de661['gid'],(_0x187315,_0x580f04)=>{if(!_0x580f04)return _0x28af9d(_0x187315);else{const _0x5e76ae=_0x580f04[_0x1a412c];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x24d5f0)+'group:\x20'+JSON['stringify'](_0x580f04)+'\x20node:\x20'+JSON['stringify'](_0x5e76ae)+'nid:\x20'+JSON['stringify'](_0x1d2a3f)+'\x20sid:\x20'+JSON['stringify'](_0x1a412c)),_0x28af9d(null,_0x5e76ae);}});});}function normalize(_0x163895,_0x3c4f62){if(_0x163895===null)return{'key':null,'gid':_0x3c4f62,'action':'put'};else return typeof _0x163895==='string'?{'key':_0x163895,'gid':_0x3c4f62,'action':'put'}:_0x163895;}function store(_0x167984){const _0x16f33e={'gid':_0x167984['gid']||'all','hash':_0x167984['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'],'subset':_0x167984['subset']};function _0x10eab0(_0x2ef6b7,_0x38ef93){if(!_0x2ef6b7){const _0x17ea1c=[{'key':null,'gid':_0x16f33e['gid']}];globalThis['distributi'+'on'][_0x16f33e['gid']]['comm']['send'](_0x17ea1c,{'service':'store','method':'get'},(_0x4a2e4d,_0x178482)=>{const _0x29f2dc=Object['values'](_0x178482)['reduce']((_0x24e18b,_0x2b1ab4)=>_0x24e18b['concat'](_0x2b1ab4),[]);_0x38ef93(_0x4a2e4d,_0x29f2dc);});return;}_0x2ef6b7=normalize(_0x2ef6b7,_0x16f33e['gid']),getNode(_0x16f33e,_0x2ef6b7,(_0x2fa49e,_0x175203)=>{if(!_0x175203){_0x38ef93(_0x2fa49e);return;}const _0x307ff0=[_0x2ef6b7],_0x39c751={'service':'store','method':'get','node':_0x175203};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x2ef6b7)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x175203)),globalThis['distributi'+'on']['local']['comm']['send'](_0x307ff0,_0x39c751,_0x38ef93);});return;return _0x38ef93(new Error('store.get\x20'+'not\x20implem'+'ented'));}function _0xb8a2c2(_0x46c1d8,_0x3db568,_0x2fc7d4){_0x3db568=_0x3db568||globalThis['distributi'+'on']['util']['id']['getID'](_0x46c1d8),_0x3db568=normalize(_0x3db568,_0x16f33e['gid']),getNode(_0x16f33e,_0x3db568,(_0x57a329,_0x4cfaf5)=>{if(!_0x4cfaf5){_0x2fc7d4(_0x57a329);return;}const _0x36a221=[_0x46c1d8,_0x3db568],_0x27fa35={'service':'store','method':'put','node':_0x4cfaf5};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x46c1d8)+('configurat'+'ion:\x20')+JSON['stringify'](_0x3db568)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x4cfaf5)),globalThis['distributi'+'on']['local']['comm']['send'](_0x36a221,_0x27fa35,_0x2fc7d4);});return;return _0x2fc7d4(new Error('store.put\x20'+'not\x20implem'+'ented'));}function _0x35f63d(_0x251e9e,_0x310679){getNode(_0x16f33e,_0x251e9e,(_0x100c81,_0x2bfec2)=>{if(!_0x2bfec2){_0x310679(_0x100c81);return;}const _0x3b78c7=[{'key':_0x251e9e,'gid':_0x16f33e['gid']}],_0x59b50f={'service':'store','method':'del','node':_0x2bfec2};globalThis['distributi'+'on']['local']['comm']['send'](_0x3b78c7,_0x59b50f,_0x310679);});return;return _0x310679(new Error('store.del\x20'+'not\x20implem'+'ented'));}function _0x319cf7(_0x3b9ecb,_0x38b6e8){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x3b9ecb)+'\x20gid:\x20'+_0x16f33e['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x16f33e['gid'],(_0xb5991f,_0x31995e)=>{if(!_0x31995e){_0x38b6e8(_0xb5991f);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x16f33e['gid'],_0x3b9ecb,(_0xa9fad1,_0x359f20)=>{globalThis['distributi'+'on'][_0x16f33e['gid']]['store']['get'](null,(_0x59ad7f,_0x461adf)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x16f33e['gid'],_0x31995e,(_0x3a7608,_0x392309)=>{globalThis['distributi'+'on'][_0x16f33e['gid']]['status']['get']('nid',(_0x413fe7,_0x1b3c9d)=>{const _0x4c3b12=Object['values'](_0x1b3c9d),_0x43ddad=Object['values'](_0x3b9ecb)['map'](_0x34d599=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x34d599));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x461adf['length']+('\x20keys\x20from'+'\x20')+_0x1b3c9d['length']+'\x20nodes');let _0x5a990f=-0x35e+0x53*-0x17+0xad3;const _0xfcd7de=()=>{if(_0x5a990f===_0x461adf['length'])return _0x38b6e8(null);};if(_0x461adf['length']===-0x1f29+-0x8*-0x11f+0x1631)return _0x38b6e8(null);for(const _0x2e69f4 of _0x461adf){const _0x2c2a50=globalThis['distributi'+'on']['util']['id']['getID'](_0x2e69f4),_0x543052=_0x16f33e['hash'](_0x2c2a50,_0x43ddad),_0x268cd0=_0x16f33e['hash'](_0x2c2a50,_0x4c3b12);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x543052+'\x20new\x20nid:\x20'+_0x268cd0);if(_0x543052===_0x268cd0){_0x5a990f++,_0xfcd7de();continue;}const _0x23d5c7=_0x3b9ecb[_0x543052['substring'](-0x1*-0xa7b+-0xf53*-0x1+-0xce7*0x2,0x2083+0x16f7+0x1*-0x3775)],_0x21600b=[{'key':_0x2e69f4,'gid':_0x16f33e['gid']}],_0x6f378e={'service':'store','method':'del','node':_0x23d5c7};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x2e69f4+'\x20from\x20'+JSON['stringify'](_0x6f378e)),globalThis['distributi'+'on']['local']['comm']['send'](_0x21600b,_0x6f378e,(_0x4f778a,_0x11da82)=>{globalThis['distributi'+'on'][_0x16f33e['gid']]['store']['put'](_0x11da82,_0x2e69f4,(_0x23ad1a,_0x12dab4)=>{_0x5a990f++,_0xfcd7de();});});}});});});});});return;return _0x38b6e8(new Error('store.reco'+'nf\x20not\x20imp'+'lemented'));}return{'get':_0x10eab0,'put':_0xb8a2c2,'del':_0x35f63d,'reconf':_0x319cf7};}module['exports']=store;
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const http=require('node:http'),log=require('../util/lo'+'g.js');function createGuardedCallback(_0x31151d){let _0x2528e6=0x482+-0x1*0x1247+-0x4b*-0x2f;function _0x43f5fd(_0x5ea8df,_0x21d0d6){_0x2528e6+=-0x7ed+0x23*-0xc5+-0x19*-0x165;if(_0x2528e6>-0x78c+-0xf1b+0x16a8){log('Warning:\x20C'+'allback\x20fu'+'nction\x20cal'+'led\x20'+_0x2528e6+'\x20times');return;}if(_0x31151d!==undefined){_0x31151d(_0x5ea8df,_0x21d0d6);return;}}return _0x43f5fd;}function send(_0x355769,_0x31c12d,_0xe37bd2){_0xe37bd2=createGuardedCallback(_0xe37bd2);if(_0x31c12d===undefined){_0xe37bd2(new Error('Remote\x20is\x20'+'required'));return;}if(_0x31c12d?.['node']?.['ip']===undefined||_0x31c12d?.['node']?.['port']===undefined){_0xe37bd2(new Error('Remote\x20nod'+'e\x20IP\x20and\x20p'+'ort\x20requir'+'ed'));return;}if(_0x31c12d?.['service']===undefined){_0xe37bd2(new Error('Remote\x20ser'+'vice\x20is\x20re'+'quired'));return;}if(_0x31c12d?.['method']===undefined){_0xe37bd2(new Error('Remote\x20met'+'hod\x20is\x20req'+'uired'));return;}if(!(_0x355769 instanceof Array)){_0xe37bd2(new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray\x20of\x20ar'+'guments'));return;}const _0x12bcfa=_0x31c12d['node'],_0x65790a=_0x31c12d['service'],_0x411682=_0x31c12d['method'],_0x1d8da9=_0x31c12d['gid']||'local';log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x355769)+'\x20to\x20'+_0x31c12d['service']+':'+_0x31c12d['method']+'\x20on\x20'+_0x31c12d['node']['ip']+':'+_0x31c12d['node']['port']);const _0x21d7e4=globalThis['distributi'+'on']['util']['serialize'](_0x355769),_0x3c7cbe={'hostname':_0x12bcfa['ip'],'port':_0x12bcfa['port'],'path':'/'+_0x1d8da9+'/'+_0x65790a+'/'+_0x411682,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x21d7e4)}},_0x103377=http['request'](_0x3c7cbe,_0x2514a8=>{let _0x22b289='';_0x2514a8['on']('data',function(_0x5a4234){_0x22b289+=_0x5a4234;}),_0x2514a8['on']('end',function(){let _0x56eb4d=undefined,_0x2582c6=undefined;try{const _0xfecd76=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x22b289);_0x56eb4d=_0xfecd76[-0x57f+-0x1*0x197b+0x1efa],_0x2582c6=_0xfecd76[-0x1*0x1f+0x35*-0xb5+0x2599];}catch(_0x32a01e){let _0x46bfcd=_0x22b289['slice'](0x1d3*0x1+-0x4f*-0x40+0x731*-0x3,0x1*0x5f6+-0x26*0x4a+-0x2fa*-0x3);_0x22b289['length']>0x24f4+0x8*0x10d+-0xe*0x2f6&&(_0x46bfcd+='...');_0xe37bd2(new Error('Failed\x20to\x20'+'deserializ'+'e\x20HTTP\x20res'+'ponse:\x20'+_0x46bfcd));return;}_0xe37bd2(_0x56eb4d,_0x2582c6);return;}),_0x2514a8['on']('error',_0xebed84=>{_0xe37bd2(new Error('HTTP\x20respo'+'nse\x20error:'+'\x20'+_0xebed84?.['message']));return;});});_0x103377['on']('error',_0x33c701=>{_0xe37bd2(new Error('HTTP\x20reque'+'st\x20error:\x20'+_0x33c701?.['message']));return;}),_0x103377['write'](_0x21d7e4),_0x103377['end']();}module['exports']={'send':send};
9
+ const http=require('node:http'),log=require('../util/lo'+'g.js');function createGuardedCallback(_0x2b0d0a){let _0x4d4299=-0x2*-0x70a+-0x278*-0xb+-0x293c;function _0x257e21(_0x49d050,_0x592541){_0x4d4299+=0x26b7+0x5*0x4b5+-0x1*0x3e3f;if(_0x4d4299>-0x11*0x149+0x6f*0x1+0x156b){log('Warning:\x20C'+'allback\x20fu'+'nction\x20cal'+'led\x20'+_0x4d4299+'\x20times');return;}if(_0x2b0d0a!==undefined){_0x2b0d0a(_0x49d050,_0x592541);return;}}return _0x257e21;}function send(_0x4f68b0,_0x51eca9,_0x403dbc){_0x403dbc=createGuardedCallback(_0x403dbc);if(_0x51eca9===undefined){_0x403dbc(new Error('Remote\x20is\x20'+'required'));return;}if(_0x51eca9?.['node']?.['ip']===undefined||_0x51eca9?.['node']?.['port']===undefined){_0x403dbc(new Error('Remote\x20nod'+'e\x20IP\x20and\x20p'+'ort\x20requir'+'ed'));return;}if(_0x51eca9?.['service']===undefined){_0x403dbc(new Error('Remote\x20ser'+'vice\x20is\x20re'+'quired'));return;}if(_0x51eca9?.['method']===undefined){_0x403dbc(new Error('Remote\x20met'+'hod\x20is\x20req'+'uired'));return;}if(!(_0x4f68b0 instanceof Array)){_0x403dbc(new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray\x20of\x20ar'+'guments'));return;}const _0x3e15cb=_0x51eca9['node'],_0x54402a=_0x51eca9['service'],_0xea0f43=_0x51eca9['method'],_0x119530=_0x51eca9['gid']||'local';log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x4f68b0)+'\x20to\x20'+_0x51eca9['service']+':'+_0x51eca9['method']+'\x20on\x20'+_0x51eca9['node']['ip']+':'+_0x51eca9['node']['port']);const _0x453a77=globalThis['distributi'+'on']['util']['serialize'](_0x4f68b0),_0x37c092={'hostname':_0x3e15cb['ip'],'port':_0x3e15cb['port'],'path':'/'+_0x119530+'/'+_0x54402a+'/'+_0xea0f43,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x453a77)}},_0x4045c9=http['request'](_0x37c092,_0x50b48f=>{let _0x5cbef9='';_0x50b48f['on']('data',function(_0x550a00){_0x5cbef9+=_0x550a00;}),_0x50b48f['on']('end',function(){let _0xd40dff=undefined,_0x17f3ca=undefined;try{const _0x4409a1=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x5cbef9);_0xd40dff=_0x4409a1[0xb0a+-0x3b9*0x3+-0x1*-0x21],_0x17f3ca=_0x4409a1[0x1eb6+-0x1e0e+-0xa7*0x1];}catch(_0x28a0eb){let _0x21ae3b=_0x5cbef9['slice'](0x12*0x1cd+0x819+-0x2883,-0x267b+0x7*0x2fb+-0x2*-0xac3);_0x5cbef9['length']>0x442+0x1322+-0x137c&&(_0x21ae3b+='...');_0x403dbc(new Error('Failed\x20to\x20'+'deserializ'+'e\x20HTTP\x20res'+'ponse:\x20'+_0x21ae3b));return;}_0x403dbc(_0xd40dff,_0x17f3ca);return;}),_0x50b48f['on']('error',_0x2688c0=>{_0x403dbc(new Error('HTTP\x20respo'+'nse\x20error:'+'\x20'+_0x2688c0?.['message']));return;});});_0x4045c9['on']('error',_0x42ae41=>{_0x403dbc(new Error('HTTP\x20reque'+'st\x20error:\x20'+_0x42ae41?.['message']));return;}),_0x4045c9['write'](_0x453a77),_0x4045c9['end']();return;return _0x403dbc(new Error('comm.send\x20'+'not\x20implem'+'ented'));}module['exports']={'send':send};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g'),groupsStore={};groupsStore['all']={},groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config'])]=globalThis['distributi'+'on']['node']['config'];function get(_0x558f44,_0x50d9e2){return _0x558f44 in groupsStore?_0x50d9e2(null,groupsStore[_0x558f44]):_0x50d9e2(new Error('Group\x20'+_0x558f44+'\x20not\x20found'),null);}function put(_0x37e256,_0x3c86c7,_0x4efe7d){log('groups.put'+':\x20config:\x20'+JSON['stringify'](_0x37e256)+'\x20group:\x20'+JSON['stringify'](_0x3c86c7)),_0x3c86c7=_0x3c86c7||{};typeof _0x37e256==='string'&&(_0x37e256={'gid':_0x37e256});if(!_0x37e256['gid'])return _0x4efe7d(Error('Config\x20gid'+'\x20was\x20null'),null);groupsStore[_0x37e256['gid']]=_0x3c86c7,Object['values'](_0x3c86c7)['forEach'](_0x48cd9d=>{groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x48cd9d)]=_0x48cd9d;});const {setup:_0x1ea597}=require('../../dist'+'ribution/a'+'ll/all.js');return globalThis['distributi'+'on'][_0x37e256['gid']]=_0x1ea597(_0x37e256),_0x4efe7d(null,_0x3c86c7);}function del(_0x3b5d3c,_0x38bccf){if(_0x3b5d3c in groupsStore){const _0x3bffce=groupsStore[_0x3b5d3c];return delete groupsStore[_0x3b5d3c],globalThis['distributi'+'on'][_0x3b5d3c]&&delete globalThis['distributi'+'on'][_0x3b5d3c],_0x38bccf(null,_0x3bffce);}else return _0x38bccf(new Error('Group\x20'+_0x3b5d3c+'\x20not\x20found'));}function add(_0x56e327,_0x8aff2a,_0x433454){log('[all.group'+'s.add]\x20gro'+'up\x20name:\x20'+_0x56e327+'\x20node:\x20'+JSON['stringify'](_0x8aff2a));if(_0x56e327 in groupsStore){!groupsStore[_0x56e327]&&(groupsStore[_0x56e327]={});groupsStore[_0x56e327][globalThis['distributi'+'on']['util']['id']['getSID'](_0x8aff2a)]=_0x8aff2a,groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x8aff2a)]=_0x8aff2a;if(_0x433454)return _0x433454(null,groupsStore[_0x56e327]);}else{if(_0x433454)return _0x433454(new Error('Group\x20'+_0x56e327+'\x20not\x20found'));}};function rem(_0x51276c,_0x3e2dbc,_0x50bb5b){return log('[all.group'+'s.rem]\x20nam'+'e:\x20'+_0x51276c+'\x20node:\x20'+_0x3e2dbc),_0x51276c in groupsStore?(delete groupsStore[_0x51276c][_0x3e2dbc],delete groupsStore['all'][_0x3e2dbc],_0x50bb5b(null,groupsStore[_0x51276c])):_0x50bb5b(new Error('Group\x20'+_0x51276c+'\x20not\x20found'));};module['exports']={'get':get,'put':put,'del':del,'add':add,'rem':rem};
9
+ const log=require('../util/lo'+'g'),groupsStore={};groupsStore['all']={},groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config'])]=globalThis['distributi'+'on']['node']['config'];function get(_0x5748d0,_0x5b311d){return _0x5748d0 in groupsStore?_0x5b311d(null,groupsStore[_0x5748d0]):_0x5b311d(new Error('Group\x20'+_0x5748d0+'\x20not\x20found'),null);return _0x5b311d(new Error('groups.get'+'\x20not\x20imple'+'mented'));}function put(_0xcee79c,_0x51fd4c,_0x4b2b48){log('groups.put'+':\x20config:\x20'+JSON['stringify'](_0xcee79c)+'\x20group:\x20'+JSON['stringify'](_0x51fd4c)),_0x51fd4c=_0x51fd4c||{};typeof _0xcee79c==='string'&&(_0xcee79c={'gid':_0xcee79c});if(!_0xcee79c['gid'])return _0x4b2b48(Error('Config\x20gid'+'\x20was\x20null'),null);groupsStore[_0xcee79c['gid']]=_0x51fd4c,Object['values'](_0x51fd4c)['forEach'](_0xfc3f1b=>{groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0xfc3f1b)]=_0xfc3f1b;});const {setup:_0x18b3ee}=require('../../dist'+'ribution/a'+'ll/all.js');globalThis['distributi'+'on'][_0xcee79c['gid']]=_0x18b3ee(_0xcee79c);return _0x4b2b48(null,_0x51fd4c);return _0x4b2b48(new Error('groups.put'+'\x20not\x20imple'+'mented'));}function del(_0x382b9b,_0x364ed3){if(_0x382b9b in groupsStore){const _0x2a528f=groupsStore[_0x382b9b];return delete groupsStore[_0x382b9b],globalThis['distributi'+'on'][_0x382b9b]&&delete globalThis['distributi'+'on'][_0x382b9b],_0x364ed3(null,_0x2a528f);}else return _0x364ed3(new Error('Group\x20'+_0x382b9b+'\x20not\x20found'));return _0x364ed3(new Error('groups.del'+'\x20not\x20imple'+'mented'));}function add(_0x149d92,_0x5165ee,_0x443236){log('[all.group'+'s.add]\x20gro'+'up\x20name:\x20'+_0x149d92+'\x20node:\x20'+JSON['stringify'](_0x5165ee));if(_0x149d92 in groupsStore){!groupsStore[_0x149d92]&&(groupsStore[_0x149d92]={});groupsStore[_0x149d92][globalThis['distributi'+'on']['util']['id']['getSID'](_0x5165ee)]=_0x5165ee,groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x5165ee)]=_0x5165ee;if(_0x443236)return _0x443236(null,groupsStore[_0x149d92]);}else{if(_0x443236)return _0x443236(new Error('Group\x20'+_0x149d92+'\x20not\x20found'));}return;return _0x443236(new Error('groups.add'+'\x20not\x20imple'+'mented'));};function rem(_0x421508,_0x363eca,_0x20828b){log('[all.group'+'s.rem]\x20nam'+'e:\x20'+_0x421508+'\x20node:\x20'+_0x363eca);return _0x421508 in groupsStore?(delete groupsStore[_0x421508][_0x363eca],delete groupsStore['all'][_0x363eca],_0x20828b(null,groupsStore[_0x421508])):_0x20828b(new Error('Group\x20'+_0x421508+'\x20not\x20found'));return _0x20828b(new Error('groups.rem'+'\x20not\x20imple'+'mented'));};module['exports']={'get':get,'put':put,'del':del,'add':add,'rem':rem};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const http=require('node:http'),url=require('node:url'),log=require('../util/lo'+'g.js'),yargs=require('yargs/yarg'+'s');function setNodeConfig(){const _0x5ac1e9=yargs(process['argv'])['help'](![])['version'](![])['parse']();let _0x58b69f,_0x318377,_0x5ac937;typeof _0x5ac1e9['ip']==='string'&&(_0x58b69f=_0x5ac1e9['ip']);(typeof _0x5ac1e9['port']==='string'||typeof _0x5ac1e9['port']==='number')&&(_0x318377=parseInt(String(_0x5ac1e9['port']),-0x409*-0x1+0x22cd+-0x26cc));(_0x5ac1e9['help']===!![]||_0x5ac1e9['h']===!![])&&(console['log']('Node\x20usage'+':'),console['log']('\x20\x20--ip\x20<ip'+'\x20address>\x20'+'\x20\x20\x20\x20\x20The\x20i'+'p\x20address\x20'+'to\x20bind\x20th'+'e\x20node\x20to'),console['log']('\x20\x20--port\x20<'+'port>\x20\x20\x20\x20\x20'+'\x20\x20\x20\x20\x20The\x20p'+'ort\x20to\x20bin'+'d\x20the\x20node'+'\x20to'),console['log']('\x20\x20--config'+'\x20<config>\x20'+'\x20\x20\x20\x20\x20The\x20s'+'erialized\x20'+'config\x20str'+'ing'),process['exit'](-0xc23+0x9bf*0x1+-0x99*-0x4));if(typeof _0x5ac1e9['config']==='string'){let _0x4fe36b=undefined;try{_0x4fe36b=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x5ac1e9['config']);}catch(_0x9d2859){try{_0x4fe36b=JSON['parse'](_0x5ac1e9['config']);}catch{console['error']('Cannot\x20des'+'erialize\x20c'+'onfig\x20stri'+'ng:\x20'+_0x5ac1e9['config']),process['exit'](0x2534*-0x1+-0xb*0x2+0x254b);}}typeof _0x4fe36b?.['ip']==='string'&&(_0x58b69f=_0x4fe36b?.['ip']),typeof _0x4fe36b?.['port']==='number'&&(_0x318377=_0x4fe36b?.['port']),typeof _0x4fe36b?.['onStart']==='function'&&(_0x5ac937=_0x4fe36b?.['onStart']);}return _0x58b69f=_0x58b69f??'127.0.0.1',_0x318377=_0x318377??-0xe73+0x7ce+-0x24b*-0x5,{'ip':_0x58b69f,'port':_0x318377,'onStart':_0x5ac937};}function validate(_0x23c72e){if(_0x23c72e['length']===0x5b5+0x1590+-0x1b45)throw new Error('No\x20body');return JSON['parse'](_0x23c72e);}function start(_0x4ea169){const _0x5df02a=http['createServ'+'er']((_0x5f8ee6,_0x189323)=>{if(_0x5f8ee6['method']!=='PUT'){_0x189323['end'](globalThis['distributi'+'on']['util']['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const [,_0x44d9a4,_0x211999,_0x4207f6]=url['parse'](_0x5f8ee6['url'])['pathname']['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0x44d9a4+'\x20'+_0x211999+':'+_0x4207f6+'\x20from\x20'+_0x5f8ee6['socket']['remoteAddr'+'ess']);const _0x24d1c6=[];_0x5f8ee6['on']('data',_0x3900dc=>{_0x24d1c6['push'](_0x3900dc);}),_0x5f8ee6['on']('end',()=>{let _0x1453e1;try{_0x1453e1=validate(Buffer['concat'](_0x24d1c6)['toString']());}catch(_0x176127){_0x189323['end'](globalThis['distributi'+'on']['util']['serialize']([_0x176127]));return;}const _0x544639=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x1453e1);!Array['isArray'](_0x544639)&&_0x189323['end'](globalThis['distributi'+'on']['util']['serialize']([new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0x544639)]));const _0x39b28a=_0x211999;globalThis['distributi'+'on']['local']['routes']['get']({'service':_0x211999,'gid':_0x44d9a4},(_0x39ce9f,_0x4f9c34)=>{if(_0x39ce9f){_0x189323['end'](globalThis['distributi'+'on']['util']['serialize']([_0x39ce9f,null]));return;}if(!_0x4f9c34[_0x4207f6]){_0x189323['end'](globalThis['distributi'+'on']['util']['serialize']([new Error('Method\x20'+_0x4207f6+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0x39b28a),null]));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0x39b28a+':'+_0x4207f6+('\x20with\x20args'+':\x20')+JSON['stringify'](_0x544639));_0x544639['length']===0x12d2+0x2f*-0x61+-0x102&&_0x4f9c34[_0x4207f6]['length']===-0x1c17+0x3b2+0x1868&&_0x544639['push'](undefined);const _0x40a06c=_0x4f9c34[_0x4207f6]['bind'](_0x4f9c34),_0x156f79=globalThis['distributi'+'on']['util']['normalize'](_0x40a06c,_0x544639);try{_0x40a06c(..._0x156f79,(_0x538e4a,_0x35be1c)=>_0x189323['end'](globalThis['distributi'+'on']['util']['serialize']([_0x538e4a,_0x35be1c])));}catch(_0x51a50e){_0x189323['end'](globalThis['distributi'+'on']['util']['serialize']([_0x51a50e,null]));}});});});globalThis['distributi'+'on']['node']['server']=_0x5df02a;const _0x18c49f=globalThis['distributi'+'on']['node']['config'];_0x5df02a['once']('listening',()=>{log('Server\x20run'+'ning\x20at\x20ht'+'tp://'+_0x18c49f['ip']+':'+_0x18c49f['port']+'/'),_0x4ea169(null);}),_0x5df02a['once']('error',_0x339745=>{log('Server\x20err'+'or:\x20'+_0x339745),_0x4ea169(_0x339745);}),_0x5df02a['listen'](_0x18c49f['port'],_0x18c49f['ip']);}module['exports']={'start':start,'config':setNodeConfig()};
9
+ const http=require('node:http'),url=require('node:url'),log=require('../util/lo'+'g.js'),yargs=require('yargs/yarg'+'s');function setNodeConfig(){const _0x12b3a0=yargs(process['argv'])['help'](![])['version'](![])['parse']();let _0x23ca2e,_0x44bf6f,_0x58f68d;typeof _0x12b3a0['ip']==='string'&&(_0x23ca2e=_0x12b3a0['ip']);(typeof _0x12b3a0['port']==='string'||typeof _0x12b3a0['port']==='number')&&(_0x44bf6f=parseInt(String(_0x12b3a0['port']),-0xd82+-0x11d0+0x24*0xdf));(_0x12b3a0['help']===!![]||_0x12b3a0['h']===!![])&&(console['log']('Node\x20usage'+':'),console['log']('\x20\x20--ip\x20<ip'+'\x20address>\x20'+'\x20\x20\x20\x20\x20The\x20i'+'p\x20address\x20'+'to\x20bind\x20th'+'e\x20node\x20to'),console['log']('\x20\x20--port\x20<'+'port>\x20\x20\x20\x20\x20'+'\x20\x20\x20\x20\x20The\x20p'+'ort\x20to\x20bin'+'d\x20the\x20node'+'\x20to'),console['log']('\x20\x20--config'+'\x20<config>\x20'+'\x20\x20\x20\x20\x20The\x20s'+'erialized\x20'+'config\x20str'+'ing'),process['exit'](0x26c+-0xcb8+0xa4c));if(typeof _0x12b3a0['config']==='string'){let _0x2edf40=undefined;try{_0x2edf40=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x12b3a0['config']);}catch(_0x196b68){try{_0x2edf40=JSON['parse'](_0x12b3a0['config']);}catch{console['error']('Cannot\x20des'+'erialize\x20c'+'onfig\x20stri'+'ng:\x20'+_0x12b3a0['config']),process['exit'](-0x583*-0x5+-0xb76+-0x1018);}}typeof _0x2edf40?.['ip']==='string'&&(_0x23ca2e=_0x2edf40?.['ip']),typeof _0x2edf40?.['port']==='number'&&(_0x44bf6f=_0x2edf40?.['port']),typeof _0x2edf40?.['onStart']==='function'&&(_0x58f68d=_0x2edf40?.['onStart']);}return _0x23ca2e=_0x23ca2e??'127.0.0.1',_0x44bf6f=_0x44bf6f??-0x7*0x4eb+0x46*-0x85+0x4b9d,{'ip':_0x23ca2e,'port':_0x44bf6f,'onStart':_0x58f68d};}function validate(_0x4c88f5){if(_0x4c88f5['length']===0x4*-0x1f8+0x175*0xf+-0x4a9*0x3)throw new Error('No\x20body');return _0x4c88f5;}function start(_0x20e157){const _0x2f4093=http['createServ'+'er']((_0x1eba6f,_0x416fca)=>{if(_0x1eba6f['method']!=='PUT'){_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const [,_0x6fdf98,_0x950986,_0x4340db]=url['parse'](_0x1eba6f['url'])['pathname']['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0x6fdf98+'\x20'+_0x950986+':'+_0x4340db+'\x20from\x20'+_0x1eba6f['socket']['remoteAddr'+'ess']);const _0x3c4653=[];_0x1eba6f['on']('data',_0x39cca0=>{_0x3c4653['push'](_0x39cca0);}),_0x1eba6f['on']('end',()=>{let _0x185859;try{_0x185859=validate(Buffer['concat'](_0x3c4653)['toString']());}catch(_0x53b0ef){_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize']([_0x53b0ef]));return;}const _0xf099cb=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x185859);!Array['isArray'](_0xf099cb)&&_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize']([new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0xf099cb)]));const _0x9b7800=_0x950986;globalThis['distributi'+'on']['local']['routes']['get']({'service':_0x950986,'gid':_0x6fdf98},(_0x45900d,_0x4af5b2)=>{if(_0x45900d){_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize']([_0x45900d,null]));return;}if(!_0x4af5b2[_0x4340db]){_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize']([new Error('Method\x20'+_0x4340db+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0x9b7800),null]));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0x9b7800+':'+_0x4340db+('\x20with\x20args'+':\x20')+JSON['stringify'](_0xf099cb));_0xf099cb['length']===0x4b*0x6e+-0x2b5+-0x1d84&&_0x4af5b2[_0x4340db]['length']===0x4a*-0x6f+-0x34*0x56+0x1*0x3191&&_0xf099cb['push'](undefined);const _0x5232b8=_0x4af5b2[_0x4340db]['bind'](_0x4af5b2),_0x15f5c3=globalThis['distributi'+'on']['util']['normalize'](_0x5232b8,_0xf099cb);try{_0x5232b8(..._0x15f5c3,(_0x159b25,_0x349259)=>_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize']([_0x159b25,_0x349259])));}catch(_0x10b5c9){_0x416fca['end'](globalThis['distributi'+'on']['util']['serialize']([_0x10b5c9,null]));}});});});globalThis['distributi'+'on']['node']['server']=_0x2f4093;const _0x225567=globalThis['distributi'+'on']['node']['config'];_0x2f4093['once']('listening',()=>{log('Server\x20run'+'ning\x20at\x20ht'+'tp://'+_0x225567['ip']+':'+_0x225567['port']+'/'),_0x20e157(null);}),_0x2f4093['once']('error',_0x49cc14=>{log('Server\x20err'+'or:\x20'+_0x49cc14),_0x20e157(_0x49cc14);}),_0x2f4093['listen'](_0x225567['port'],_0x225567['ip']);}module['exports']={'start':start,'config':setNodeConfig()};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x5d20c0,_0x534a0a){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x5d20c0));if(!_0x5d20c0)return _0x534a0a(new Error('No\x20configu'+'ration\x20pro'+'vided!'));typeof _0x5d20c0==='string'&&(_0x5d20c0={'service':_0x5d20c0});const _0x105318=_0x5d20c0['service'],_0x372b05=_0x5d20c0['gid'];if(_0x372b05&&_0x372b05!=='local')return log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x105318),_0x534a0a(null,globalThis['distributi'+'on'][_0x372b05][_0x105318]);else{const _0x3b2d89=routesStore['get'](_0x105318);if(_0x3b2d89)return log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x105318),_0x534a0a(null,_0x3b2d89);else{const _0x133ff0=globalThis['toLocal']['get'](_0x105318);return _0x133ff0?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x105318),_0x534a0a(null,{'call':_0x133ff0})):_0x534a0a(new Error('Service\x20'+_0x105318+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x5d97d9,_0x52d181,_0x21481c){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x52d181),routesStore['set'](_0x52d181,_0x5d97d9);if(_0x21481c)return _0x21481c(null,_0x52d181);}function rem(_0x8118fd,_0x3e6011){const _0x5bedf8=routesStore['get'](_0x8118fd);return routesStore['delete'](_0x8118fd),_0x3e6011(null,_0x5bedf8);}module['exports']={'get':get,'put':put,'rem':rem};
9
+ const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x3c878b,_0x2d8a42){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x3c878b));if(!_0x3c878b)return _0x2d8a42(new Error('No\x20configu'+'ration\x20pro'+'vided!'));typeof _0x3c878b==='string'&&(_0x3c878b={'service':_0x3c878b});const _0x7cc0c2=_0x3c878b['service'],_0x1d7c39=_0x3c878b['gid'];if(_0x1d7c39&&_0x1d7c39!=='local')return log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x7cc0c2),_0x2d8a42(null,globalThis['distributi'+'on'][_0x1d7c39][_0x7cc0c2]);else{const _0x33155b=routesStore['get'](_0x7cc0c2);if(_0x33155b)return log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x7cc0c2),_0x2d8a42(null,_0x33155b);else{const _0x2f3260=globalThis['toLocal']['get'](_0x7cc0c2);return _0x2f3260?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x7cc0c2),_0x2d8a42(null,{'call':_0x2f3260})):_0x2d8a42(new Error('Service\x20'+_0x7cc0c2+('\x20not\x20found'+'\x20in\x20routes')));}}return _0x2d8a42(new Error('routes.get'+'\x20not\x20imple'+'mented'));}function put(_0xf948d0,_0x194d97,_0xa8d9f8){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x194d97),routesStore['set'](_0x194d97,_0xf948d0);return _0xa8d9f8(null,_0x194d97);return _0xa8d9f8(new Error('routes.put'+'\x20not\x20imple'+'mented'));}function rem(_0x485265,_0x567b0f){const _0xd2df8c=routesStore['get'](_0x485265);routesStore['delete'](_0x485265);return _0x567b0f(null,_0xd2df8c);return _0x567b0f(new Error('routes.rem'+'\x20not\x20imple'+'mented'));}module['exports']={'get':get,'put':put,'rem':rem};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g'),counts=-0x4f+0xfe7+-0xf98;function get(_0x2c24ae,_0x5c033c){if(_0x2c24ae in globalThis['distributi'+'on']['node']['config']){_0x5c033c(null,globalThis['distributi'+'on']['node']['config'][_0x2c24ae]);return;}if(_0x2c24ae==='sid'){_0x5c033c(null,globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x2c24ae==='nid'){_0x5c033c(null,globalThis['distributi'+'on']['util']['id']['getNID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x2c24ae==='counts'){_0x5c033c(null,counts);return;}if(_0x2c24ae==='heapTotal'){_0x5c033c(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x2c24ae==='heapUsed'){_0x5c033c(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x5c033c(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),proc=require('node:child'+'_process');function getDistribution(){let _0x3f0b9e='';try{const _0x1cbbec=proc['execSync']('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x3f0b9e=path['join'](_0x1cbbec,'distributi'+'on.js');if(fs['existsSync'](_0x3f0b9e))return _0x3f0b9e;}catch(_0xfed2a){log('[status]\x20C'+'ould\x20not\x20d'+'etermine\x20g'+'it\x20root:',_0xfed2a['message']);}_0x3f0b9e=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x3f0b9e))return _0x3f0b9e;_0x3f0b9e=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x3f0b9e))return _0x3f0b9e;throw new Error('Failed\x20to\x20'+'find\x20proje'+'ct\x20root.');}function createOnStart(_0x38aea5,_0x2aa927){const _0xa6ec22='\x0a\x20\x20\x20\x20retur'+'n\x20function'+'(e)\x20{\x0a\x20\x20\x20\x20'+'\x20\x20let\x20onSt'+'art\x20=\x20'+_0x38aea5['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20le'+'t\x20callback'+'RPC\x20=\x20')+globalThis['distributi'+'on']['util']['wire']['createRPC'](globalThis['distributi'+'on']['util']['wire']['toAsync'](_0x2aa927))['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20if'+'\x20(e)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ackRPC(e,\x20'+'null,\x20()\x20='+'>\x20{});\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20retur'+'n;\x0a\x20\x20\x20\x20\x20\x20}'+'\x0a\x20\x20\x20\x20\x20\x20try'+'\x20{\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20onStart()'+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(null,\x20gl'+'obal.distr'+'ibution.no'+'de.config,'+'\x20()\x20=>\x20{})'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'catch(e)\x20{'+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20c'+'allbackRPC'+'(e,\x20null,\x20'+'()\x20=>\x20{});'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20};\x0a\x20\x20');return new Function(_0xa6ec22)();}function spawn(_0xc218b7,_0x23a157){const _0x4685a4=_0xc218b7;_0x4685a4['onStart']=_0x4685a4['onStart']||function(){};if(!_0x4685a4['port']||!_0x4685a4['ip']){_0x23a157(new Error('Port\x20and\x20I'+'P\x20are\x20requ'+'ired\x20in\x20th'+'e\x20configur'+'ation'));return;}log('[status.sp'+'awn]\x20Spawn'+'ing\x20node\x20w'+'ith\x20config'+'uration:\x20'+JSON['stringify'](_0x4685a4));const _0x596771=(_0x3e522b,_0x4f4143)=>{if(_0x3e522b){_0x23a157(_0x3e522b);return;}globalThis['distributi'+'on']['local']['groups']['add']('all',_0x4f4143,()=>{_0x23a157(_0x3e522b,_0x4f4143);});};_0x4685a4['onStart']=createOnStart(_0x4685a4['onStart'],_0x596771);const _0x4cf835=getDistribution();log('[status.sp'+'awn]\x20Using'+'\x20distribut'+'ion\x20path:\x20'+_0x4cf835);const _0x2dc4d9=proc['spawn']('node',[_0x4cf835,'--config',globalThis['distributi'+'on']['util']['serialize'](_0x4685a4)],{'detached':!![],'stdio':'inherit'});_0x2dc4d9;return;_0x23a157(new Error('status.spa'+'wn\x20not\x20imp'+'lemented'));}function stop(_0x49b3ed){log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),globalThis['distributi'+'on']['node']['server']['close'](),process['nextTick'](()=>process['exit'](-0xda*-0x1+-0x15fe+0x1524));return _0x49b3ed(null,globalThis['distributi'+'on']['node']['config']);_0x49b3ed(new Error('status.sto'+'p\x20not\x20impl'+'emented'));}module['exports']={'get':get,'spawn':spawn,'stop':stop};
9
+ const log=require('../util/lo'+'g'),counts=0x8a8*-0x1+0x2537+-0x985*0x3;function get(_0x1a50b3,_0x30db05){if(_0x1a50b3 in globalThis['distributi'+'on']['node']['config']){_0x30db05(null,globalThis['distributi'+'on']['node']['config'][_0x1a50b3]);return;}if(_0x1a50b3==='sid'){_0x30db05(null,globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x1a50b3==='nid'){_0x30db05(null,globalThis['distributi'+'on']['util']['id']['getNID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x1a50b3==='counts'){_0x30db05(null,counts);return;}if(_0x1a50b3==='heapTotal'){_0x30db05(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x1a50b3==='heapUsed'){_0x30db05(null,process['memoryUsag'+'e']()['heapUsed']);return;}return _0x30db05(new Error('Status\x20key'+'\x20not\x20found'));return _0x30db05(new Error('status.get'+'\x20not\x20imple'+'mented'));};const fs=require('fs'),path=require('path'),proc=require('node:child'+'_process');function getDistribution(){let _0x1136ce='';try{const _0x5ef89a=proc['execSync']('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x1136ce=path['join'](_0x5ef89a,'distributi'+'on.js');if(fs['existsSync'](_0x1136ce))return _0x1136ce;}catch(_0xdddb85){log('[status]\x20C'+'ould\x20not\x20d'+'etermine\x20g'+'it\x20root:',_0xdddb85['message']);}_0x1136ce=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x1136ce))return _0x1136ce;_0x1136ce=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x1136ce))return _0x1136ce;throw new Error('Failed\x20to\x20'+'find\x20proje'+'ct\x20root.');}function createOnStart(_0x15e5ae,_0x5d1f67){const _0x525c88='\x0a\x20\x20\x20\x20retur'+'n\x20function'+'(e)\x20{\x0a\x20\x20\x20\x20'+'\x20\x20let\x20onSt'+'art\x20=\x20'+_0x15e5ae['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20le'+'t\x20callback'+'RPC\x20=\x20')+globalThis['distributi'+'on']['util']['wire']['createRPC'](globalThis['distributi'+'on']['util']['wire']['toAsync'](_0x5d1f67))['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20if'+'\x20(e)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ackRPC(e,\x20'+'null,\x20()\x20='+'>\x20{});\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20retur'+'n;\x0a\x20\x20\x20\x20\x20\x20}'+'\x0a\x20\x20\x20\x20\x20\x20try'+'\x20{\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20onStart()'+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(null,\x20gl'+'obal.distr'+'ibution.no'+'de.config,'+'\x20()\x20=>\x20{})'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'catch(e)\x20{'+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20c'+'allbackRPC'+'(e,\x20null,\x20'+'()\x20=>\x20{});'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20};\x0a\x20\x20');return new Function(_0x525c88)();}function spawn(_0x1e1257,_0x427366){const _0x549ffe=_0x1e1257;_0x549ffe['onStart']=_0x549ffe['onStart']||function(){};if(!_0x549ffe['port']||!_0x549ffe['ip']){_0x427366(new Error('Port\x20and\x20I'+'P\x20are\x20requ'+'ired\x20in\x20th'+'e\x20configur'+'ation'));return;}log('[status.sp'+'awn]\x20Spawn'+'ing\x20node\x20w'+'ith\x20config'+'uration:\x20'+JSON['stringify'](_0x549ffe));const _0x189e4c=(_0x3a9f27,_0xfc46c8)=>{if(_0x3a9f27){_0x427366(_0x3a9f27);return;}globalThis['distributi'+'on']['local']['groups']['add']('all',_0xfc46c8,()=>{_0x427366(_0x3a9f27,_0xfc46c8);});};_0x549ffe['onStart']=createOnStart(_0x549ffe['onStart'],_0x189e4c);const _0x199ff3=getDistribution();log('[status.sp'+'awn]\x20Using'+'\x20distribut'+'ion\x20path:\x20'+_0x199ff3);const _0x1f1f23=proc['spawn']('node',[_0x199ff3,'--config',globalThis['distributi'+'on']['util']['serialize'](_0x549ffe)],{'detached':!![],'stdio':'inherit'});_0x1f1f23;return;_0x427366(new Error('status.spa'+'wn\x20not\x20imp'+'lemented'));}function stop(_0x46a0a8){log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),globalThis['distributi'+'on']['node']['server']['close'](),process['nextTick'](()=>process['exit'](-0x16eb*0x1+-0x2*0xc6e+0x2fc7));return _0x46a0a8(null,globalThis['distributi'+'on']['node']['config']);_0x46a0a8(new Error('status.sto'+'p\x20not\x20impl'+'emented'));}module['exports']={'get':get,'spawn':spawn,'stop':stop};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x14db7c=[];function _0xc568ec(_0x9633c3,_0x2a391c){if(_0x2a391c===null||_0x2a391c===undefined)return;if(_0x14db7c['indexOf'](_0x2a391c)!==-(0xa53+-0x14c0+-0x3*-0x37a))return;_0x14db7c['push'](_0x2a391c),Object['getOwnProp'+'ertyNames'](_0x2a391c)['forEach'](_0x14aee6=>{if(typeof _0x2a391c[_0x14aee6]==='function'){nativeFunctions['forward']['set'](_0x2a391c[_0x14aee6],_0x9633c3+'.'+_0x14aee6),nativeFunctions['reverse']['set'](_0x9633c3+'.'+_0x14aee6,_0x2a391c[_0x14aee6]);return;}typeof _0x2a391c[_0x14aee6]==='object'&&_0x14db7c['indexOf'](_0x2a391c[_0x14aee6])===-(-0xaa+-0x12bd*-0x1+0x909*-0x2)&&_0xc568ec(_0x9633c3+'.'+_0x14aee6,_0x2a391c[_0x14aee6]);});}for(const _0x3178d9 of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0x3178d9))continue;const _0x4eda68=require(_0x3178d9);_0xc568ec(_0x3178d9,_0x4eda68);}}createNativeMap();function decycleObject(_0x11dc48){if(_0x11dc48===null||_0x11dc48===undefined)return _0x11dc48;const _0x3450d6=new WeakMap();function _0x117782(_0x2c0bb9,_0x4f42ef){let _0x4239b;if(!(typeof _0x2c0bb9==='object'&&!(_0x2c0bb9 instanceof Error)&&!(_0x2c0bb9 instanceof Date)&&!(_0x2c0bb9 instanceof Boolean)&&_0x2c0bb9!==null))return _0x2c0bb9;const _0x82b432=_0x3450d6['get'](_0x2c0bb9);if(_0x82b432!==undefined)return{'$reference':_0x82b432};return _0x3450d6['set'](_0x2c0bb9,_0x4f42ef),Array['isArray'](_0x2c0bb9)?(_0x4239b=[],_0x2c0bb9['forEach'](function(_0x4b1cc9,_0x2abd2f){const _0x549465=[..._0x4f42ef,_0x2abd2f];_0x4239b[_0x2abd2f]=_0x117782(_0x4b1cc9,_0x549465);})):(_0x4239b={},Object['keys'](_0x2c0bb9)['forEach'](_0x52b780=>{const _0x8a54c2=[..._0x4f42ef,JSON['stringify'](_0x52b780)];_0x4239b[_0x52b780]=_0x117782(_0x2c0bb9[_0x52b780],_0x8a54c2);})),_0x4239b;}return _0x117782(_0x11dc48,[]);}function serializeBaseStructure(_0x183c86){return{'type':typeof _0x183c86,'value':_0x183c86['toString']()};}function serializeBigInt(_0x50c78d){return{'type':'bigint','value':_0x50c78d['toString']()};}function serializeUndefined(_0xa3e9aa){return{'type':'undefined','value':''};}function serializeObject(_0x2f3d29){if(_0x2f3d29===null)return{'type':'null','value':''};else{if(_0x2f3d29 instanceof Date)return{'type':'date','value':_0x2f3d29['toJSON']()};else{if(_0x2f3d29 instanceof Error)return{'type':'error','value':serializeObject({'name':_0x2f3d29['name'],'message':_0x2f3d29['message'],'cause':_0x2f3d29['cause']})};}}if(_0x2f3d29['$reference']!==undefined&&Object['keys'](_0x2f3d29)['length']===-0x1085+0x3*-0x3f+0x1143)return{'type':'reference','value':_0x2f3d29['$reference']};const _0x305989=Object['fromEntrie'+'s'](Object['entries'](_0x2f3d29)['map'](([_0x49315d,_0x4751fa])=>[_0x49315d,serialize(_0x4751fa)]));return{'type':_0x2f3d29 instanceof Array?'array':'object','value':_0x305989};}function serializeFunction(_0x141fc6){const _0x2f1181=nativeFunctions['forward']['get'](_0x141fc6);return _0x2f1181===undefined?{'type':'function','value':_0x141fc6['toString']()}:{'type':'native','value':_0x2f1181};}function serialize(_0x246c81){_0x246c81=decycleObject(_0x246c81);let _0x22c608;switch(typeof _0x246c81){case'object':_0x22c608=serializeObject(_0x246c81);break;case'function':_0x22c608=serializeFunction(_0x246c81);break;case'undefined':_0x22c608=serializeUndefined(_0x246c81);break;case'number':case'string':case'boolean':_0x22c608=serializeBaseStructure(_0x246c81);break;case'bigint':_0x22c608=serializeBigInt(_0x246c81);break;}return JSON['stringify'](_0x22c608);}function deserializeObject(_0x13720b,_0xe7277b){for(const [_0x29105e,_0x21a9c1]of Object['entries'](_0x13720b)){_0xe7277b[_0x29105e]=doSerialize(_0x21a9c1,_0xe7277b);}return _0xe7277b;}function deserializeArray(_0x2c1ece,_0x25b297){for(const [_0x58044e,_0x1750e7]of Object['entries'](_0x2c1ece)){_0x25b297[Number(_0x58044e)]=doSerialize(_0x1750e7,_0x25b297);}return _0x25b297;}function deserializeString(_0x185ae9){return _0x185ae9;}function deserializeNumber(_0x29cfe5){return Number(_0x29cfe5);}function deserializeFunction(_0x1496a7){return new Function('return\x20'+_0x1496a7)();}function deserializeError(_0x42d6b6){const _0x29588f=doSerialize(_0x42d6b6),_0x4b582b=new Error(_0x29588f['message'],_0x29588f['cause']);return _0x4b582b;}function deserializeReference(_0x2091f3,_0x219745){let _0x477c2e=_0x219745;for(const _0x2d5710 of _0x2091f3){_0x477c2e=_0x477c2e[JSON['parse'](_0x2d5710)];}return _0x477c2e;}function deserializeNative(_0x1b2e12){const _0x1b336b=nativeFunctions['reverse']['get'](_0x1b2e12);if(_0x1b336b===undefined)throw Error('Function\x20n'+'ot\x20found\x20i'+'n\x20native\x20f'+'unction\x20ma'+'p');return _0x1b336b;}function deserializeReferences(_0x4e4974,_0x39af26){if(typeof _0x4e4974!=='object'||_0x4e4974===null)return _0x4e4974;if(_0x4e4974['type']==='reference')return deserializeReference(_0x4e4974['value'],_0x39af26);if(Array['isArray'](_0x4e4974))for(let _0x57cdf9=-0x47f*0x1+0x1*0x12c1+-0xe42;_0x57cdf9<_0x4e4974['length'];_0x57cdf9++){_0x4e4974[_0x57cdf9]=deserializeReferences(_0x4e4974[_0x57cdf9],_0x39af26);}else for(const [_0x30bf49,_0x3677f1]of Object['entries'](_0x4e4974)){_0x4e4974[_0x30bf49]=deserializeReferences(_0x3677f1,_0x39af26);}return _0x4e4974;}function doSerialize(_0x5140c6,_0x493991=null){let _0x21a7cc;if(typeof _0x5140c6==='object')_0x21a7cc=_0x5140c6;else{if(typeof _0x5140c6==='string')_0x21a7cc=JSON['parse'](_0x5140c6);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x5140c6+'.');}_0x493991===null&&(_0x493991={});switch(_0x21a7cc['type']){case'object':return deserializeObject(_0x21a7cc['value'],{});case'array':return deserializeArray(_0x21a7cc['value'],[]);case'function':return deserializeFunction(_0x21a7cc['value']);case'native':return deserializeNative(_0x21a7cc['value']);case'reference':return _0x21a7cc;case'number':return deserializeNumber(_0x21a7cc['value']);case'string':return deserializeString(_0x21a7cc['value']);case'boolean':return _0x21a7cc['value']==='true';case'bigint':return BigInt(_0x21a7cc['value']);case'date':return new Date(_0x21a7cc['value']);case'error':return deserializeError(_0x21a7cc['value']);case'null':return null;case'undefined':return undefined;default:throw new Error('Invalid\x20se'+'rialized\x20o'+'bject\x20type');}}function deserialize(_0x1ea2cd){const _0x817c57=doSerialize(_0x1ea2cd);return deserializeReferences(_0x817c57,_0x817c57),_0x817c57;}module['exports']={'serialize':serialize,'deserialize':deserialize};
9
+ const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x404350=[];function _0x3f00f3(_0x5ac571,_0x269c43){if(_0x269c43===null||_0x269c43===undefined)return;if(_0x404350['indexOf'](_0x269c43)!==-(-0x10e7+0x172e+0x1*-0x646))return;_0x404350['push'](_0x269c43),Object['getOwnProp'+'ertyNames'](_0x269c43)['forEach'](_0x4e2d8a=>{if(typeof _0x269c43[_0x4e2d8a]==='function'){nativeFunctions['forward']['set'](_0x269c43[_0x4e2d8a],_0x5ac571+'.'+_0x4e2d8a),nativeFunctions['reverse']['set'](_0x5ac571+'.'+_0x4e2d8a,_0x269c43[_0x4e2d8a]);return;}typeof _0x269c43[_0x4e2d8a]==='object'&&_0x404350['indexOf'](_0x269c43[_0x4e2d8a])===-(0x3b7*-0x1+-0x115*0x6+0xa36)&&_0x3f00f3(_0x5ac571+'.'+_0x4e2d8a,_0x269c43[_0x4e2d8a]);});}for(const _0xcd95ea of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0xcd95ea))continue;const _0x5739bc=require(_0xcd95ea);_0x3f00f3(_0xcd95ea,_0x5739bc);}}createNativeMap();function decycleObject(_0x34e228){if(_0x34e228===null||_0x34e228===undefined)return _0x34e228;const _0x540b4e=new WeakMap();function _0x38a577(_0x78cf26,_0x1b0f00){let _0xcc04b0;if(!(typeof _0x78cf26==='object'&&!(_0x78cf26 instanceof Error)&&!(_0x78cf26 instanceof Date)&&!(_0x78cf26 instanceof Boolean)&&_0x78cf26!==null))return _0x78cf26;const _0xf3d91e=_0x540b4e['get'](_0x78cf26);if(_0xf3d91e!==undefined)return{'$reference':_0xf3d91e};return _0x540b4e['set'](_0x78cf26,_0x1b0f00),Array['isArray'](_0x78cf26)?(_0xcc04b0=[],_0x78cf26['forEach'](function(_0x32bd04,_0x8a6618){const _0x1c3add=[..._0x1b0f00,_0x8a6618];_0xcc04b0[_0x8a6618]=_0x38a577(_0x32bd04,_0x1c3add);})):(_0xcc04b0={},Object['keys'](_0x78cf26)['forEach'](_0x177fb4=>{const _0x51fc50=[..._0x1b0f00,JSON['stringify'](_0x177fb4)];_0xcc04b0[_0x177fb4]=_0x38a577(_0x78cf26[_0x177fb4],_0x51fc50);})),_0xcc04b0;}return _0x38a577(_0x34e228,[]);}function serializeBaseStructure(_0x10f456){return{'type':typeof _0x10f456,'value':_0x10f456['toString']()};}function serializeBigInt(_0xbdc724){return{'type':'bigint','value':_0xbdc724['toString']()};}function serializeUndefined(_0xb3c155){return{'type':'undefined','value':''};}function serializeObject(_0x1db01e){if(_0x1db01e===null)return{'type':'null','value':''};else{if(_0x1db01e instanceof Date)return{'type':'date','value':_0x1db01e['toJSON']()};else{if(_0x1db01e instanceof Error)return{'type':'error','value':serializeObject({'name':_0x1db01e['name'],'message':_0x1db01e['message'],'cause':_0x1db01e['cause']})};}}if(_0x1db01e['$reference']!==undefined&&Object['keys'](_0x1db01e)['length']===-0x14*-0x17+0xa*-0x1a5+-0xb*-0x155)return{'type':'reference','value':_0x1db01e['$reference']};const _0x20c2d2=Object['fromEntrie'+'s'](Object['entries'](_0x1db01e)['map'](([_0x59c0aa,_0xfb4a8e])=>[_0x59c0aa,serialize(_0xfb4a8e)]));return{'type':_0x1db01e instanceof Array?'array':'object','value':_0x20c2d2};}function serializeFunction(_0x38e653){const _0x38fb7a=nativeFunctions['forward']['get'](_0x38e653);return _0x38fb7a===undefined?{'type':'function','value':_0x38e653['toString']()}:{'type':'native','value':_0x38fb7a};}function serialize(_0x4d944c){_0x4d944c=decycleObject(_0x4d944c);let _0x449851;switch(typeof _0x4d944c){case'object':_0x449851=serializeObject(_0x4d944c);break;case'function':_0x449851=serializeFunction(_0x4d944c);break;case'undefined':_0x449851=serializeUndefined(_0x4d944c);break;case'number':case'string':case'boolean':_0x449851=serializeBaseStructure(_0x4d944c);break;case'bigint':_0x449851=serializeBigInt(_0x4d944c);break;}return JSON['stringify'](_0x449851);}function deserializeObject(_0xb07ca,_0x1d43e4){for(const [_0xa696f6,_0x4f0f65]of Object['entries'](_0xb07ca)){_0x1d43e4[_0xa696f6]=doSerialize(_0x4f0f65,_0x1d43e4);}return _0x1d43e4;}function deserializeArray(_0x46048f,_0x47c969){for(const [_0x15070e,_0x5ba4a3]of Object['entries'](_0x46048f)){_0x47c969[Number(_0x15070e)]=doSerialize(_0x5ba4a3,_0x47c969);}return _0x47c969;}function deserializeString(_0x37b705){return _0x37b705;}function deserializeNumber(_0x471aa0){return Number(_0x471aa0);}function deserializeFunction(_0x612ed7){return new Function('return\x20'+_0x612ed7)();}function deserializeError(_0x2e3adb){const _0x4f1b6c=doSerialize(_0x2e3adb),_0x5f4632=new Error(_0x4f1b6c['message'],_0x4f1b6c['cause']);return _0x5f4632;}function deserializeReference(_0x287fe9,_0x17258d){let _0x38b8a5=_0x17258d;for(const _0x22de58 of _0x287fe9){_0x38b8a5=_0x38b8a5[JSON['parse'](_0x22de58)];}return _0x38b8a5;}function deserializeNative(_0x11d654){const _0x56229e=nativeFunctions['reverse']['get'](_0x11d654);if(_0x56229e===undefined)throw Error('Function\x20n'+'ot\x20found\x20i'+'n\x20native\x20f'+'unction\x20ma'+'p');return _0x56229e;}function deserializeReferences(_0x39daf1,_0x1d28d2){if(typeof _0x39daf1!=='object'||_0x39daf1===null)return _0x39daf1;if(_0x39daf1['type']==='reference')return deserializeReference(_0x39daf1['value'],_0x1d28d2);if(Array['isArray'](_0x39daf1))for(let _0x47cbb4=-0x1ed6+0x3e7+0x563*0x5;_0x47cbb4<_0x39daf1['length'];_0x47cbb4++){_0x39daf1[_0x47cbb4]=deserializeReferences(_0x39daf1[_0x47cbb4],_0x1d28d2);}else for(const [_0xbd32ca,_0x4eef23]of Object['entries'](_0x39daf1)){_0x39daf1[_0xbd32ca]=deserializeReferences(_0x4eef23,_0x1d28d2);}return _0x39daf1;}function doSerialize(_0x3b5585,_0x588a31=null){let _0x5d5928;if(typeof _0x3b5585==='object')_0x5d5928=_0x3b5585;else{if(typeof _0x3b5585==='string')_0x5d5928=JSON['parse'](_0x3b5585);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x3b5585+'.');}_0x588a31===null&&(_0x588a31={});switch(_0x5d5928['type']){case'object':return deserializeObject(_0x5d5928['value'],{});case'array':return deserializeArray(_0x5d5928['value'],[]);case'function':return deserializeFunction(_0x5d5928['value']);case'native':return deserializeNative(_0x5d5928['value']);case'reference':return _0x5d5928;case'number':return deserializeNumber(_0x5d5928['value']);case'string':return deserializeString(_0x5d5928['value']);case'boolean':return _0x5d5928['value']==='true';case'bigint':return BigInt(_0x5d5928['value']);case'date':return new Date(_0x5d5928['value']);case'error':return deserializeError(_0x5d5928['value']);case'null':return null;case'undefined':return undefined;default:throw new Error('Invalid\x20se'+'rialized\x20o'+'bject\x20type');}}function deserialize(_0x1b2d00){if(typeof _0x1b2d00!=='string')throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x1b2d00+'.');const _0x17e244=doSerialize(_0x1b2d00);return deserializeReferences(_0x17e244,_0x17e244),_0x17e244;}module['exports']={'serialize':serialize,'deserialize':deserialize};
10
10
  /* eslint-enable */
package/distribution.js CHANGED
@@ -24,6 +24,12 @@ function bootstrap(config) {
24
24
  // @ts-ignore This is the first time globalThis.distribution is being initialized, so the object does not have all the necessary properties.
25
25
  globalThis.distribution = distribution;
26
26
  distribution.util = require('./distribution/util/util.js');
27
+
28
+ /* __start_M3_solution__
29
+ distribution.util.serialize = distributionLib.util.serialize;
30
+ distribution.util.deserialize = distributionLib.util.deserialize;
31
+ __end_M3_solution__ */
32
+
27
33
  // @ts-ignore node.server is lazily initialized.
28
34
  distribution.node = require('./distribution/local/node.js');
29
35
  distribution.local = require('./distribution/local/local.js');
@@ -37,7 +43,6 @@ function bootstrap(config) {
37
43
 
38
44
  /* Overrides when missing functionality from previous milestone or extra credit is needed */
39
45
 
40
- // For M3, when missing RPC, its path through routes, and status.{spawn, stop}
41
46
  /* __start_M3_solution__
42
47
  distribution.util.wire.createRPC = distributionLib.util.wire.createRPC;
43
48
  distribution.local.routes = distributionLib.local.routes;
@@ -45,8 +50,6 @@ function bootstrap(config) {
45
50
  distribution.local.status.stop = distributionLib.local.status.stop;
46
51
  distribution.local.comm = distributionLib.local.comm;
47
52
  distribution.node.start = distributionLib.node.start;
48
- distribution.util.serialize = distributionLib.util.serialize;
49
- distribution.util.deserialize = distributionLib.util.deserialize;
50
53
  __end_M3_solution__ */
51
54
 
52
55
  for (const [key, service] of Object.entries(distribution.local)) {
@@ -61,15 +64,14 @@ function bootstrap(config) {
61
64
  It can either be:
62
65
  1. The reference implementation from the library @brown-ds/distribution
63
66
  2. Your own, local implementation
64
-
65
- Which one to be used by the tests is determined by the "useLibrary" value in the package.json file.
67
+ Set "useLibrary" in package.json to true or false accordingly.
66
68
  */
67
69
  // @ts-ignore JSON import resolved at runtime.
68
70
  const {useLibrary} = require('./package.json');
69
71
  // @ts-ignore Optional dependency for reference implementation.
70
72
  const distribution = useLibrary ? require('@brown-ds/distribution') : bootstrap;
71
73
 
72
- /* The following code is run when distribution.js is run directly */
74
+ /* The following code is run when distribution.js is invoked directly */
73
75
  if (require.main === module) {
74
76
  globalThis.distribution = distribution();
75
77
  // __start_solution__
@@ -78,7 +80,9 @@ if (require.main === module) {
78
80
  JSON.stringify(globalThis.distribution.node.config)
79
81
  }`,
80
82
  );
83
+ // __end_solution__
81
84
  globalThis.distribution.node.start(globalThis.distribution.node.config.onStart || (() => {
85
+ // Start REPL for interactive use
82
86
  const repl = require('node:repl');
83
87
  repl.start({
84
88
  prompt: `${globalThis.distribution.util.id.getSID(globalThis.distribution.node.config)}> `,
@@ -88,7 +92,6 @@ if (require.main === module) {
88
92
  useGlobal: true,
89
93
  });
90
94
  }));
91
- // __end_solution__
92
95
  }
93
96
 
94
97
  module.exports = distribution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brown-ds/distribution",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "A library for building distributed systems.",
5
5
  "main": "distribution.js",
6
6
  "useLibrary": false,