@brown-ds/distribution 0.1.4 → 0.1.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 +5 -0
- package/distribution/util/serialization.js +1 -1
- package/package.json +19 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ There are several categories of tests:
|
|
|
16
16
|
* Regular Tests (`*.test.js`)
|
|
17
17
|
* Scenario Tests (`*.scenario.js`)
|
|
18
18
|
* Extra Credit Tests (`*.extra.test.js`)
|
|
19
|
+
* Student Tests (`*.student.test.js`) - inside `test/test-student`
|
|
19
20
|
|
|
20
21
|
### Running Tests
|
|
21
22
|
|
|
@@ -74,3 +75,7 @@ You can also send messages to other nodes:
|
|
|
74
75
|
```js
|
|
75
76
|
distribution.all.comm.send(['sid'], {node: node, service: 'status', method: 'get'}, console.log); // 8cf1c
|
|
76
77
|
```
|
|
78
|
+
|
|
79
|
+
# Results and Reflections
|
|
80
|
+
|
|
81
|
+
> ...
|
|
@@ -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
|
|
9
|
+
const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x23de2e=[];function _0xbb0e59(_0x3b3ca1,_0x19c497){if(_0x19c497===null||_0x19c497===undefined)return;if(_0x23de2e['indexOf'](_0x19c497)!==-(0x449*-0x2+0x1777*0x1+-0xee4))return;_0x23de2e['push'](_0x19c497),Object['getOwnProp'+'ertyNames'](_0x19c497)['forEach'](_0x20f76b=>{if(typeof _0x19c497[_0x20f76b]==='function'){nativeFunctions['forward']['set'](_0x19c497[_0x20f76b],_0x3b3ca1+'.'+_0x20f76b),nativeFunctions['reverse']['set'](_0x3b3ca1+'.'+_0x20f76b,_0x19c497[_0x20f76b]);return;}typeof _0x19c497[_0x20f76b]==='object'&&_0x23de2e['indexOf'](_0x19c497[_0x20f76b])===-(0x207e+0x1bfb+-0x3c78)&&_0xbb0e59(_0x3b3ca1+'.'+_0x20f76b,_0x19c497[_0x20f76b]);});}for(const _0x48e6f7 of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0x48e6f7))continue;const _0x259a2f=require(_0x48e6f7);_0xbb0e59(_0x48e6f7,_0x259a2f);}}createNativeMap();function decycleObject(_0x4a136c){if(_0x4a136c===null||_0x4a136c===undefined)return _0x4a136c;const _0x21d2b8=new WeakMap();function _0x4711d9(_0x4b012f,_0x54c3f3){let _0x130aaa;if(!(typeof _0x4b012f==='object'&&!(_0x4b012f instanceof Error)&&!(_0x4b012f instanceof Date)&&!(_0x4b012f instanceof Boolean)&&_0x4b012f!==null))return _0x4b012f;const _0x382721=_0x21d2b8['get'](_0x4b012f);if(_0x382721!==undefined)return{'$reference':_0x382721};return _0x21d2b8['set'](_0x4b012f,_0x54c3f3),Array['isArray'](_0x4b012f)?(_0x130aaa=[],_0x4b012f['forEach'](function(_0x59773e,_0x30f68f){const _0x44816c=[..._0x54c3f3,_0x30f68f];_0x130aaa[_0x30f68f]=_0x4711d9(_0x59773e,_0x44816c);})):(_0x130aaa={},Object['keys'](_0x4b012f)['forEach'](_0xfeb2b8=>{const _0x2cf11f=[..._0x54c3f3,JSON['stringify'](_0xfeb2b8)];_0x130aaa[_0xfeb2b8]=_0x4711d9(_0x4b012f[_0xfeb2b8],_0x2cf11f);})),_0x130aaa;}return _0x4711d9(_0x4a136c,[]);};function serializeBaseStructure(_0x23bba5){return{'type':typeof _0x23bba5,'value':_0x23bba5['toString']()};}function serializeUndefined(_0x50228c){return{'type':'undefined','value':''};}function getObjectSubType(_0x159214){if(_0x159214 instanceof Array)return'array';if(_0x159214 instanceof Date)return'date';if(_0x159214 instanceof Error)return'error';if(_0x159214===null)return'null';return'object';}function serializeObject(_0x574ad8){const _0x3c8955=getObjectSubType(_0x574ad8);if(_0x3c8955==='null')return{'type':_0x3c8955,'value':''};if(_0x3c8955==='date')return{'type':_0x3c8955,'value':_0x574ad8['toJSON']()};if(_0x3c8955==='error')return{'type':_0x3c8955,'value':serializeObject({'name':_0x574ad8['name'],'message':_0x574ad8['message'],'cause':_0x574ad8['cause']})};function _0xfb778c(_0x220579){return Object['keys'](_0x220579)['length']==0x8c+0x1265+-0x12f0&&Object['keys'](_0x220579)[0x818+-0x3ea+-0x42e]=='$reference';}if(_0xfb778c(_0x574ad8))return{'type':'reference','value':_0x574ad8['$reference']};const _0x54256f={};for(const [_0x1b6323,_0x28ee3d]of Object['entries'](_0x574ad8)){_0x54256f[_0x1b6323]=serialize(_0x28ee3d);}return{'type':_0x3c8955,'value':_0x54256f};}function serializeFunction(_0x25b5a1){if(nativeFunctions['forward']['has'](_0x25b5a1))return{'type':'native','value':nativeFunctions['forward']['get'](_0x25b5a1)};return{'type':'function','value':_0x25b5a1['toString']()};}function serialize(_0x121261){_0x121261=decycleObject(_0x121261);let _0x371c0a;switch(typeof _0x121261){case'object':_0x371c0a=serializeObject(_0x121261);break;case'function':_0x371c0a=serializeFunction(_0x121261);break;case'undefined':_0x371c0a=serializeUndefined(_0x121261);break;case'number':case'string':case'boolean':_0x371c0a=serializeBaseStructure(_0x121261);break;}return JSON['stringify'](_0x371c0a);}function deserializeObject(_0x44f43f,_0x3ee716){for(const [_0x3118bd,_0x4d2bf5]of Object['entries'](_0x44f43f)){_0x3ee716[_0x3118bd]=doSerialize(_0x4d2bf5,_0x3ee716);}return _0x3ee716;}function deserializeArray(_0x587ccf,_0x743561){for(const [_0xa5a463,_0x87b682]of Object['entries'](_0x587ccf)){_0x743561[_0xa5a463]=doSerialize(_0x87b682,_0x743561);}return _0x743561;}function deserializeString(_0x5536e1){return _0x5536e1;}function deserializeNumber(_0x2bc0ad){return Number(_0x2bc0ad);}function deserializeFunction(_0x2a0c06){return new Function('return\x20'+_0x2a0c06)();}function deserializeError(_0x21a5ef){const _0x381e35=doSerialize(_0x21a5ef),_0x3fdad2=new Error(_0x381e35['message'],_0x381e35['cause']);return _0x3fdad2;}function deserializeReference(_0x3c2961,_0x2b05a1){let _0x22e9d6=_0x2b05a1;for(let _0x78ff58 of _0x3c2961){_0x78ff58=JSON['parse'](_0x78ff58),_0x22e9d6=_0x22e9d6[_0x78ff58];}return _0x22e9d6;}function deserializeNative(_0xd33203){return nativeFunctions['reverse']['get'](_0xd33203);}function doSerialize(_0x4345eb,_0x3a4cb1=null){let _0x29bb02;if(typeof _0x4345eb==='object')_0x29bb02=_0x4345eb;else{if(typeof _0x4345eb==='string')_0x29bb02=JSON['parse'](_0x4345eb);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x4345eb+'.');}_0x3a4cb1===null&&(_0x3a4cb1={});switch(_0x29bb02['type']){case'object':_0x3a4cb1=deserializeObject(_0x29bb02['value'],{});break;case'array':_0x3a4cb1=deserializeArray(_0x29bb02['value'],[]);break;case'function':_0x3a4cb1=deserializeFunction(_0x29bb02['value']);break;case'native':_0x3a4cb1=deserializeNative(_0x29bb02['value']);break;case'reference':_0x3a4cb1=deserializeReference(_0x29bb02['value'],_0x3a4cb1);break;case'number':_0x3a4cb1=deserializeNumber(_0x29bb02['value']);break;case'string':_0x3a4cb1=deserializeString(_0x29bb02['value']);break;case'boolean':_0x3a4cb1=_0x29bb02['value']==='true';break;case'date':_0x3a4cb1=new Date(_0x29bb02['value']);break;case'error':_0x3a4cb1=deserializeError(_0x29bb02['value']);break;case'null':_0x3a4cb1=null;break;case'undefined':_0x3a4cb1=undefined;break;}return _0x3a4cb1;}function deserialize(_0x49e39d){return doSerialize(_0x49e39d);}module['exports']={'serialize':serialize,'deserialize':deserialize};
|
|
10
10
|
/* eslint-enable */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brown-ds/distribution",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A library for building distributed systems.",
|
|
5
5
|
"main": "distribution.js",
|
|
6
6
|
"useLibrary": false,
|
|
@@ -23,5 +23,23 @@
|
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"yargs": "^17.7.2"
|
|
26
|
+
},
|
|
27
|
+
"report": {
|
|
28
|
+
"hours": 999,
|
|
29
|
+
"loc": 999,
|
|
30
|
+
"dev": {
|
|
31
|
+
"cpu-no": 999,
|
|
32
|
+
"mem-gb": 999,
|
|
33
|
+
"ssd-gb": 999
|
|
34
|
+
},
|
|
35
|
+
"throughput": {
|
|
36
|
+
"dev": [],
|
|
37
|
+
"aws": []
|
|
38
|
+
},
|
|
39
|
+
"latency": {
|
|
40
|
+
"dev": [],
|
|
41
|
+
"aws": []
|
|
42
|
+
},
|
|
43
|
+
"dloc": -99
|
|
26
44
|
}
|
|
27
45
|
}
|