Built motion from commit (unavailable).|2.1.0
[motion2.git] / server / services / routing / lib / rule-engine.js
index 3e43d83..cb3a3ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfdf2=['toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','concat','isObject','push','sync','activeRules','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call','next','length','condition','matchPath','findRules','matches','turn','prioritize'];(function(_0x26cbe8,_0x188e8f){var _0x5ef53a=function(_0xdad142){while(--_0xdad142){_0x26cbe8['push'](_0x26cbe8['shift']());}};_0x5ef53a(++_0x188e8f);}(_0xfdf2,0x1b5));var _0x2fdf=function(_0x26315a,_0x377bf2){_0x26315a=_0x26315a-0x0;var _0x286929=_0xfdf2[_0x26315a];return _0x286929;};'use strict';var _=require(_0x2fdf('0x0'));var util=require(_0x2fdf('0x1'));var EventEmitter=require(_0x2fdf('0x2'))[_0x2fdf('0x3')];function RuleEngine(_0x3bcbbd,_0xc343aa){this[_0x2fdf('0x4')]();if(!_[_0x2fdf('0x5')](_0x3bcbbd)){this[_0x2fdf('0x6')](_0x3bcbbd);}if(_0xc343aa){this[_0x2fdf('0x7')]=_0xc343aa[_0x2fdf('0x7')];}return this;}util[_0x2fdf('0x8')](RuleEngine,EventEmitter);RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x4')]=function(_0x7733de){this['rules']=[];this['activeRules']=[];};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x6')]=function(_0x14ff72){if(Array['isArray'](_0x14ff72)){this[_0x2fdf('0xa')]=this[_0x2fdf('0xa')][_0x2fdf('0xb')](_0x14ff72);}else if(_0x14ff72!==null&&_[_0x2fdf('0xc')](_0x14ff72)){this[_0x2fdf('0xa')][_0x2fdf('0xd')](_0x14ff72);}this[_0x2fdf('0xe')]();};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0xe')]=function(){this[_0x2fdf('0xf')]=this[_0x2fdf('0xa')][_0x2fdf('0x10')](function(_0x53149d){if(_[_0x2fdf('0x5')](_0x53149d['on'])){_0x53149d['on']=!![];}if(_0x53149d['on']===!![]){return _0x53149d;}});this[_0x2fdf('0xf')]=_[_0x2fdf('0x11')](this['activeRules'],['p'],[_0x2fdf('0x12')]);};RuleEngine['prototype'][_0x2fdf('0x13')]=function(_0x61e62a,_0x2dfa61){var _0x2f6f17=![];_0x61e62a[_0x2fdf('0x14')]=!![];var _0x59b0a7=_['clone'](_0x61e62a);var _0x45e6a0=_[_0x2fdf('0x15')](_0x61e62a);var _0x54df01=this[_0x2fdf('0xf')];var _0x1d2c7e=[];var _0x18bd85=this['ignoreFactChanges'];(function FnRuleLoop(_0x5bc741){var _0x2664e6={'rules':function(){return _0x54df01;},'rule':function(){return _0x54df01[_0x5bc741];},'when':function(_0x58904d){if(_0x58904d){var _0x28d63d=_0x54df01[_0x5bc741][_0x2fdf('0x16')];_0x28d63d[_0x2fdf('0x17')]=_0x54df01[_0x5bc741]['id']||_0x54df01[_0x5bc741][_0x2fdf('0x18')]||_0x2fdf('0x19')+_0x5bc741;process[_0x2fdf('0x1a')](function(){_0x1d2c7e[_0x2fdf('0xd')](_0x28d63d[_0x2fdf('0x17')]);_0x28d63d[_0x2fdf('0x1b')](_0x59b0a7,_0x2664e6);});}else{process['nextTick'](function(){_0x2664e6[_0x2fdf('0x1c')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2f6f17=!![];return FnRuleLoop(0x0);},'next':function(_0x30ab3d){if(!_0x18bd85&&!_['isEqual'](_0x45e6a0,_0x59b0a7)){_0x45e6a0=_[_0x2fdf('0x15')](_0x59b0a7);process[_0x2fdf('0x1a')](function(){_0x2664e6['restart']();});}else{process[_0x2fdf('0x1a')](function(){if(_['isNil'](_0x30ab3d)){return FnRuleLoop(_0x5bc741+0x1);}else{return FnRuleLoop(_0x30ab3d);}});}}};if(_0x5bc741<_0x54df01[_0x2fdf('0x1d')]&&_0x2f6f17===![]){var _0x45e8b6=_0x54df01[_0x5bc741][_0x2fdf('0x1e')];_0x45e8b6[_0x2fdf('0x1b')](_0x59b0a7,_0x2664e6);}else{process[_0x2fdf('0x1a')](function(){_0x59b0a7[_0x2fdf('0x1f')]=_0x1d2c7e;return _0x2dfa61?_0x2dfa61(_0x59b0a7):_['noop']();});}}(0x0));};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x20')]=function(_0x47a561){if(_[_0x2fdf('0x5')](_0x47a561)){return this[_0x2fdf('0xa')];}else{var _0x13ee38=_[_0x2fdf('0x21')](_0x47a561);return _[_0x2fdf('0x10')](this['rules'],_0x13ee38);}};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x22')]=function(_0x1997f8,_0x1da2ff){var _0x1997f8=_0x1997f8==='on'||_0x1997f8==='ON'?!![]:![];var _0x522983=this[_0x2fdf('0x20')](_0x1da2ff);for(var _0x1e2873=0x0,_0x5ef871=_0x522983['length'];_0x1e2873<_0x5ef871;_0x1e2873+=0x1){_0x522983[_0x1e2873]['on']=_0x1997f8;}this['sync']();};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x23')]=function(_0x4093c7,_0x4dad9f){_0x4093c7=parseInt(_0x4093c7,0xa);var _0x252ef2=this[_0x2fdf('0x20')](_0x4dad9f);for(var _0x39d22b=0x0,_0x1d0eae=_0x252ef2[_0x2fdf('0x1d')];_0x39d22b<_0x1d0eae;_0x39d22b+=0x1){_0x252ef2[_0x39d22b]['priority']=_0x4093c7;}this[_0x2fdf('0xe')]();};RuleEngine['prototype'][_0x2fdf('0x24')]=function(){var _0x5b541f=this['rules'];if(_0x5b541f instanceof Array){_0x5b541f=_0x5b541f[_0x2fdf('0x25')](function(_0x19b4ba){_0x19b4ba[_0x2fdf('0x1e')]=_0x19b4ba[_0x2fdf('0x1e')][_0x2fdf('0x26')]();_0x19b4ba[_0x2fdf('0x16')]=_0x19b4ba[_0x2fdf('0x16')]['toString']();return _0x19b4ba;});}else if(!_[_0x2fdf('0x5')](_0x5b541f)){_0x5b541f[_0x2fdf('0x1e')]=_0x5b541f[_0x2fdf('0x1e')][_0x2fdf('0x26')]();_0x5b541f[_0x2fdf('0x16')]=_0x5b541f[_0x2fdf('0x16')]['toString']();}return _0x5b541f;};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x27')]=function(_0x2d13f6){this['init']();if(_['isString'](_0x2d13f6)){_0x2d13f6=JSON[_0x2fdf('0x28')](_0x2d13f6);}if(_0x2d13f6 instanceof Array){_0x2d13f6=_0x2d13f6[_0x2fdf('0x25')](function(_0x4c78e6){_0x4c78e6['condition']=eval('('+_0x4c78e6[_0x2fdf('0x1e')]+')');_0x4c78e6[_0x2fdf('0x16')]=eval('('+_0x4c78e6[_0x2fdf('0x16')]+')');return _0x4c78e6;});}else if(_0x2d13f6!==null&&typeof _0x2d13f6==_0x2fdf('0x29')){_0x2d13f6[_0x2fdf('0x1e')]=eval('('+_0x2d13f6[_0x2fdf('0x1e')]+')');_0x2d13f6[_0x2fdf('0x16')]=eval('('+_0x2d13f6['consequence']+')');}this[_0x2fdf('0x6')](_0x2d13f6);};module[_0x2fdf('0x2a')]=RuleEngine;
\ No newline at end of file
+var _0x311a=['sync','activeRules','filter','orderBy','asc','execute','result','clone','ruleRef','name','index_','nextTick','call','isEqual','noop','findRules','matches','turn','length','prioritize','condition','toString','consequence','init','isString','parse','object','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x311a,0x15b));var _0xa311=function(_0x402e12,_0x5268b9){_0x402e12=_0x402e12-0x0;var _0x4627b4=_0x311a[_0x402e12];return _0x4627b4;};'use strict';var _=require('lodash');var util=require(_0xa311('0x0'));var EventEmitter=require(_0xa311('0x1'))[_0xa311('0x2')];function RuleEngine(_0x4d4f4d,_0x3c9085){this['init']();if(!_[_0xa311('0x3')](_0x4d4f4d)){this[_0xa311('0x4')](_0x4d4f4d);}if(_0x3c9085){this[_0xa311('0x5')]=_0x3c9085[_0xa311('0x5')];}return this;}util[_0xa311('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xa311('0x7')]['init']=function(_0x5b43aa){this[_0xa311('0x8')]=[];this['activeRules']=[];};RuleEngine[_0xa311('0x7')][_0xa311('0x4')]=function(_0x1910b6){if(Array[_0xa311('0x9')](_0x1910b6)){this[_0xa311('0x8')]=this[_0xa311('0x8')][_0xa311('0xa')](_0x1910b6);}else if(_0x1910b6!==null&&_[_0xa311('0xb')](_0x1910b6)){this[_0xa311('0x8')][_0xa311('0xc')](_0x1910b6);}this[_0xa311('0xd')]();};RuleEngine[_0xa311('0x7')][_0xa311('0xd')]=function(){this[_0xa311('0xe')]=this[_0xa311('0x8')][_0xa311('0xf')](function(_0xed0893){if(_[_0xa311('0x3')](_0xed0893['on'])){_0xed0893['on']=!![];}if(_0xed0893['on']===!![]){return _0xed0893;}});this['activeRules']=_[_0xa311('0x10')](this[_0xa311('0xe')],['p'],[_0xa311('0x11')]);};RuleEngine[_0xa311('0x7')][_0xa311('0x12')]=function(_0x183ffc,_0x56d6e7){var _0x1c5f42=![];_0x183ffc[_0xa311('0x13')]=!![];var _0xf1d2b8=_[_0xa311('0x14')](_0x183ffc);var _0x262ac9=_['clone'](_0x183ffc);var _0x476c31=this[_0xa311('0xe')];var _0x3cf883=[];var _0x3103ac=this[_0xa311('0x5')];(function FnRuleLoop(_0x282a65){var _0x12e13c={'rules':function(){return _0x476c31;},'rule':function(){return _0x476c31[_0x282a65];},'when':function(_0x5bec94){if(_0x5bec94){var _0x53ffa1=_0x476c31[_0x282a65]['consequence'];_0x53ffa1[_0xa311('0x15')]=_0x476c31[_0x282a65]['id']||_0x476c31[_0x282a65][_0xa311('0x16')]||_0xa311('0x17')+_0x282a65;process[_0xa311('0x18')](function(){_0x3cf883[_0xa311('0xc')](_0x53ffa1[_0xa311('0x15')]);_0x53ffa1[_0xa311('0x19')](_0xf1d2b8,_0x12e13c);});}else{process['nextTick'](function(){_0x12e13c['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x1c5f42=!![];return FnRuleLoop(0x0);},'next':function(_0x2afcf7){if(!_0x3103ac&&!_[_0xa311('0x1a')](_0x262ac9,_0xf1d2b8)){_0x262ac9=_[_0xa311('0x14')](_0xf1d2b8);process[_0xa311('0x18')](function(){_0x12e13c['restart']();});}else{process[_0xa311('0x18')](function(){if(_[_0xa311('0x3')](_0x2afcf7)){return FnRuleLoop(_0x282a65+0x1);}else{return FnRuleLoop(_0x2afcf7);}});}}};if(_0x282a65<_0x476c31['length']&&_0x1c5f42===![]){var _0x418bc4=_0x476c31[_0x282a65]['condition'];_0x418bc4[_0xa311('0x19')](_0xf1d2b8,_0x12e13c);}else{process['nextTick'](function(){_0xf1d2b8['matchPath']=_0x3cf883;return _0x56d6e7?_0x56d6e7(_0xf1d2b8):_[_0xa311('0x1b')]();});}}(0x0));};RuleEngine[_0xa311('0x7')][_0xa311('0x1c')]=function(_0x287da4){if(_[_0xa311('0x3')](_0x287da4)){return this[_0xa311('0x8')];}else{var _0x3353de=_[_0xa311('0x1d')](_0x287da4);return _[_0xa311('0xf')](this[_0xa311('0x8')],_0x3353de);}};RuleEngine[_0xa311('0x7')][_0xa311('0x1e')]=function(_0x151730,_0x5f148b){var _0x151730=_0x151730==='on'||_0x151730==='ON'?!![]:![];var _0x498b81=this['findRules'](_0x5f148b);for(var _0x50bfa5=0x0,_0x135b49=_0x498b81[_0xa311('0x1f')];_0x50bfa5<_0x135b49;_0x50bfa5+=0x1){_0x498b81[_0x50bfa5]['on']=_0x151730;}this['sync']();};RuleEngine['prototype'][_0xa311('0x20')]=function(_0x58e5b3,_0x1c63d6){_0x58e5b3=parseInt(_0x58e5b3,0xa);var _0x245012=this[_0xa311('0x1c')](_0x1c63d6);for(var _0x16c067=0x0,_0x6d2a32=_0x245012[_0xa311('0x1f')];_0x16c067<_0x6d2a32;_0x16c067+=0x1){_0x245012[_0x16c067]['priority']=_0x58e5b3;}this[_0xa311('0xd')]();};RuleEngine[_0xa311('0x7')]['toJSON']=function(){var _0x5b405b=this[_0xa311('0x8')];if(_0x5b405b instanceof Array){_0x5b405b=_0x5b405b['map'](function(_0x2f2e22){_0x2f2e22[_0xa311('0x21')]=_0x2f2e22[_0xa311('0x21')][_0xa311('0x22')]();_0x2f2e22[_0xa311('0x23')]=_0x2f2e22[_0xa311('0x23')][_0xa311('0x22')]();return _0x2f2e22;});}else if(!_[_0xa311('0x3')](_0x5b405b)){_0x5b405b['condition']=_0x5b405b[_0xa311('0x21')]['toString']();_0x5b405b[_0xa311('0x23')]=_0x5b405b[_0xa311('0x23')]['toString']();}return _0x5b405b;};RuleEngine[_0xa311('0x7')]['fromJSON']=function(_0x4cc7ec){this[_0xa311('0x24')]();if(_[_0xa311('0x25')](_0x4cc7ec)){_0x4cc7ec=JSON[_0xa311('0x26')](_0x4cc7ec);}if(_0x4cc7ec instanceof Array){_0x4cc7ec=_0x4cc7ec['map'](function(_0x5e3cc4){_0x5e3cc4['condition']=eval('('+_0x5e3cc4[_0xa311('0x21')]+')');_0x5e3cc4[_0xa311('0x23')]=eval('('+_0x5e3cc4[_0xa311('0x23')]+')');return _0x5e3cc4;});}else if(_0x4cc7ec!==null&&typeof _0x4cc7ec==_0xa311('0x27')){_0x4cc7ec[_0xa311('0x21')]=eval('('+_0x4cc7ec[_0xa311('0x21')]+')');_0x4cc7ec[_0xa311('0x23')]=eval('('+_0x4cc7ec[_0xa311('0x23')]+')');}this['register'](_0x4cc7ec);};module['exports']=RuleEngine;
\ No newline at end of file