UNPKG

hilary

Version:

a simple Dependency Injection (DI) library that provides Inversion of Control (IoC) capabilities in Node.js and the browser

3 lines (2 loc) 22.8 kB
/*! hilary 2018-04-29 */ if(function(a){"use strict";!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"locale",factory:{errorTypes:{INVALID_ARG:"InvalidArgument",INVALID_REGISTRATION:"InvalidRegistration",MODULE_NOT_FOUND:"ModuleNotFound",MODULE_NOT_RESOLVED:"ModuleNotResolved",BOOTSTRAP_FAILED:"BootstrapFailed"},container:{CONSUMER_REQUIRED:"A consumer function is required to `enumerate` over a container"},hilaryModule:{FACTORY_UNDEFINED:"This implementation does not satisfy blueprint, Hilary::HilaryModule. It should have the property, factory.",DEPENDENCIES_NO_FACTORY:"Dependencies were declared, but the factory is not a function, so they cannot be applied.",DEPENDENCY_FACTORY_MISMATCH:"The number of dependencies that were declared does not match the number of arguments that the factory accepts."},api:{REGISTER_ERR:"register failed. see cause for more information",REGISTER_ARG:"register expects either a hilary module, or an array of hilary modules as the first argument, but instead saw this: ",RESOLVE_ARG:"resolve expects a moduleName (string) as the first argument, but instead saw this: ",MODULE_NOT_FOUND:'The module, "{{module}}", cannot be found',MODULE_NOT_FOUND_RELYING:', and is a dependency of, "{{startingModule}}"',MODULE_THREW:'The module, "{{module}}", cannot be resolved because it returned or threw an Error',REGISTRATION_BLACK_LIST:"A module was registered with a reserved name: ",PARENT_CONTAINER_ARG:"setParentScope expects the name of the parent scope, or an instance of Hilary"},bootstrap:{TASKS_ARRAY:"bootstrap expects the first argument to be an array of functions",INVALID_TASK_ARGUMENT:"The task expected a first argument of scope, and a callback as the second argument"}}})}(),function(a){"use strict";function b(a){return{isException:!0,type:a.type,error:c(a),messages:d(a),data:a.data}}function c(a){return"object"==typeof a.error?a.error:"string"==typeof a.error?new Error(a.error):new Error}function d(a){return Array.isArray(a.messages)?a.messages:"string"==typeof a.messages?[a.messages]:a.error&&a.error.message?[a.error.message]:[]}!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"Exception",factory:b})}(),function(a){"use strict";function b(a,b,c,d){return function(){function c(){return k}function e(a){k[a.name]=a}function f(a){return k[a]}function g(a){return!!b.regexp(a)||k.hasOwnProperty(a)}function h(c){var e;if(!b.function(c))return new d({type:a.errorTypes.INVALID_ARG,error:new Error(a.container.CONSUMER_REQUIRED)});for(e in k)k.hasOwnProperty(e)&&c(e,k[e])}function i(a){var c,d,e,f,g={result:!0,disposed:[]};if(b.string(a))return l.disposeOne(a);if(b.array(a)){for(d=0;d<a.length;d+=1)e=l.disposeOne(a[d]),g.result=g.result&&e,e&&g.disposed.push(a[d]);return g}if(a)return!1;f=!0;for(c in k)k.hasOwnProperty(c)&&(f=f&&l.disposeOne(c));return f}function j(a){return!!k[a]&&(delete k[a],!0)}var k={},l={get:c,register:e,resolve:f,exists:g,enumerate:h,dispose:i,disposeOne:j};return l}}!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"Container",factory:b})}(),function(a){"use strict";function b(a,b,d,e){var f=new a({__blueprintId:"Hilary::Context",scope:"string",parent:{type:"string",required:!1},container:{type:"object",required:!1},singletonContainer:{type:"object",required:!1}});return function(a){var g={};return f.validate(a).result?(c(g,"scope",a.scope),g.parent=a.parent,c(g,"container",a.container||new b),c(g,"singletonContainer",a.singletonContainer||new b),g):new d({type:e.errorTypes.INVALID_ARG,messages:f.validate(a).errors})}}function c(a,b,c){Object.defineProperty(a,b,{enumerable:!0,configurable:!1,get:function(){return c},set:function(){console.log(b+" is read only")}})}!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"Context",factory:b})}(),function(a){"use strict";function b(a,b,c,d,e){var f=new b({__blueprintId:"Hilary::HilaryModule",isHilaryModule:"boolean",name:"string",singleton:{type:"boolean",required:!1},dependencies:{type:"array",required:!1},factory:{validate:function(b,c,e){a.not.defined(b)?c.push(d.hilaryModule.FACTORY_UNDEFINED):a.not.function(b)&&a.array(e.dependencies)&&e.dependencies.length?c.push(d.hilaryModule.DEPENDENCIES_NO_FACTORY):a.function(b)&&a.array(e.dependencies)&&e.dependencies.length&&b.length!==e.dependencies.length&&c.push(d.hilaryModule.DEPENDENCY_FACTORY_MISMATCH)}}});return function(b){return b=b||{},b.isHilaryModule=!0,b.singleton=!a.boolean(b.singleton)||b.singleton,a.not.defined(b.dependencies)&&a.function(b.factory)?b.dependencies=c.getArgumentNames(b.factory):!1===b.dependencies&&(b.dependencies=[]),f.validate(b).result?b:new e({type:d.errorTypes.INVALID_REGISTRATION,error:new Error(d.api.REGISTER_ARG+JSON.stringify(b)),messages:f.validate(b).errors,data:b})}}!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"HilaryModule",factory:b})}(),function(a){"use strict";function b(a){function b(b){var c,d,e;if(b="string"==typeof b?{}:b||{},b.logging=b.logging||{},b.logging.level&&a.string(b.logging.level))switch(b.logging.level){case"debug":c=20;break;case"info":c=30;break;case"warn":c=40;break;case"error":c=50;break;case"fatal":c=60;break;case"off":c=70;break;default:c=10}else c=b.logging.level&&a.number(b.logging.level)&&b.logging.level>0&&b.logging.level<=70?b.logging.level:30;return d=a.function(b.logging.log)?b.logging.log:null,e=a.function(b.logging.printer)?b.logging.printer:null,{level:c,log:d,printer:e}}function c(a){return a.log?function(b,c){return a.log(b,new d(c[0]))}:a.printer?function(b,c){if(!(b<a.level))return a.printer(new d(c[0]))}:function(b,c){var e;if(!(b<a.level)){switch(b){case 60:case 50:e=console.error||console.log;break;case 40:e=console.warn||console.log;break;default:e=console.log}e.apply(null,new d(c))}}}function d(b){return a.string(b)?{message:b}:b}return function(a){var d=c(new b(a));return{trace:function(){d(10,arguments)},debug:function(){d(20,arguments)},info:function(){d(30,arguments)},warn:function(){d(40,arguments)},error:function(){d(50,arguments)},fatal:function(){d(60,arguments)}}}}!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"Logger",factory:b})}(),function(a){"use strict";function b(a,b,f,g){function h(a,b,c){try{return e(b)?(c=c?[null].concat(c):[null],new(Function.prototype.bind.apply(b,c))):b.apply(null,c)}catch(b){return new g({type:f.errorTypes.MODULE_NOT_RESOLVED,messages:[f.api.MODULE_THREW.replace(/{{module}}/,a),b.message],error:b})}}return function(e,i,j){function k(a,c){b.string(a.name)?(i.trace("module name is valid: "+a.name),c(null,a)):(i.error("module name is INVALID: "+a.name),c(new g({type:f.errorTypes.INVALID_ARG,error:new Error(f.api.RESOLVE_ARG+JSON.stringify(a.name))})))}function l(a,b){var d=c(a.name);return e.singletonContainer.exists(a.name)?(i.trace("found singleton for: "+a.name),a.resolved=e.singletonContainer.resolve(a.name).factory,a.isResolved=!0,a.registerSingleton=!1,b(null,a)):d.members.length&&e.container.exists(d.name)?(i.trace("found factory for: "+a.name),a.theModule=e.container.resolve(d.name),a.members=d.members,b(null,a)):e.container.exists(a.name)?(i.trace("found factory for: "+a.name),a.theModule=e.container.resolve(a.name),b(null,a)):(i.trace("module not found: "+a.name),a.parsedName=d.name,a.members=d.members,b(v(a)))}function m(a,b){var c=d(a.parsedName);return c?(i.trace("found module (via degrade) for: "+a.name),a.resolved=c,a.isResolved=!0,a.registerSingleton=a.members.length>0,b(null,a)):b(v(a))}function n(a,b,c){return Object.keys(b.singletonContainer.get()).concat(Object.keys(b.container.get())).reduce(function(a,b){return-1===a.indexOf(b)&&a.push(b),a},[]).filter(function(b){return b!==c&&a.test(b)})}function o(a){return function(b,c,d){var e=j(a,c);return e?e.isException||e instanceof Error?(i.error("the following dependency returned an exception: "+a),d(e)):(i.trace("the following dependency was resolved: "+a),b.push(e),void d(null,b,c)):(i.trace("the following dependency was not resolved: "+a),d(null,b,c))}}function p(b,c){const d=b.map(o);return d.unshift(function(a){a(null,[],c.relyingName)}),function(b,c,e){a.waterfall(d,{blocking:!0},function(a,d){return a?e(a):(b.push(d),e(null,b,c))})}}function q(c,d){var f=c.theModule.dependencies.reduce(function(a,d){if(b.regexp(d)){var f=n(d,e,c.name);return a=a.concat(p(f,c))}return a.push(o(d)),a},[]);return f.unshift(function(a){a(null,[],c.relyingName)}),a.waterfall(f,{blocking:!0},function(a,b){if(a)return i.trace({message:"at least one dependency was not found for: "+c.name,err:a}),d(a);c.resolved=h(c.theModule.name,c.theModule.factory,b),c.registerSingleton=c.theModule.singleton,c.isResolved=!0,i.trace("dependencies resolved for: "+c.name),d(null,c)})}function r(a,c){return i.trace("resolving dependencies for: "+a.name),a.isResolved?c(null,a):b.array(a.theModule.dependencies)&&a.theModule.dependencies.length>0?(i.trace("resolving with dependencies array: "+a.theModule.dependencies.join(", ")),q(a,c)):(b.function(a.theModule.factory)&&0===a.theModule.factory.length?(i.trace("the factory is a function and takes no arguments, returning the result of executing it: "+a.name),a.resolved=h(a.theModule.name,a.theModule.factory)):(i.trace("the factory takes arguments and has no dependencies, returning the function as-is: "+a.name),a.resolved=a.theModule.factory),a.registerSingleton=a.theModule.singleton,a.isResolved=!0,void c(null,a))}function s(a,b){var c;return a.members.length?1===a.members.length?(a.resolved.hasOwnProperty(a.members[0].member)||i.trace("the following dependency was NOT reduced to chosen members: "+a.name),i.trace("the following dependency was reduced to chosen members: "+a.name),a.resolved=a.resolved[a.members[0].member],b(null,a)):(c={},a.members.forEach(function(b){c[b.alias]=a.resolved[b.member]}),i.trace("the following dependency was reduced to chosen members: "+a.name),a.resolved=c,b(null,a)):b(null,a)}function t(a,b){a.registerSingleton&&(i.trace("registering the resolved module as a singleton: "+a.name),e.singletonContainer.register({name:a.name,factory:a.resolved}),i.trace("removing the resolved module registration: "+a.name),e.container.dispose(a.name)),b(null,a)}function u(a,b){i.trace("binding the module to the output: "+a.name),b(null,a.resolved)}function v(a){var b=f.api.MODULE_NOT_FOUND.replace("{{module}}",a.name);return a.name!==a.relyingName&&(b+=f.api.MODULE_NOT_FOUND_RELYING.replace("{{startingModule}}",a.relyingName)),new g({type:f.errorTypes.MODULE_NOT_FOUND,error:new Error(b),data:{moduleName:a.name,relyingModuleName:a.relyingName}})}return{validateModuleName:k,findModule:l,findDegraded:m,resolveDependencies:r,reduceMembers:s,optionallyRegisterSingleton:t,bindToOutput:u,filterMatchingRegistrations:n}}}function c(a){var b=/\{([^}]+)\}/.exec(a),c=[];return b&&(a=a.split("{")[0].trim(),c=b[1].split(",").map(function(a){var b=a.trim(),c=b.split(" ");return 3===c.length&&"as"===c[1].toLowerCase()?{member:c[0],alias:c[2]}:{member:b,alias:b}})),{name:a,members:c}}function d(a){if("undefined"!=typeof module&&module.exports&&require)try{return require.main&&"function"==typeof require.main.require?require.main.require(a):require(a)}catch(a){return null}else if("undefined"!=typeof window)return window[a]}function e(a){try{return new a,!0}catch(a){if(a.message.indexOf("is not a constructor"))return!1}}!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"ResolveTasks",factory:b})}(),function(a){"use strict";function b(a,b,i,j,k,l,m,n,o,p){var q,r,s={};return q=function(c){function d(a,c){var d=new Error(k.api.REGISTER_ERR);if(b.object(a))return F.trace({message:"Registering a single module",module:a}),e(a,d,c);if(b.array(a))return F.trace({message:"Registering an array of modules",modules:a}),z(function(){return a.forEach(e),C},d,c);var f=new m({type:k.errorTypes.INVALID_ARG,error:new Error(k.api.REGISTER_ARG+JSON.stringify(a)),data:a});return F.error({message:"Registration failed",exception:f}),b.function(c)&&c(f),f}function e(c,d,e){var f=[];if(C.name===h&&c&&c.scope&&c.scope!==h)return C.scope(c.scope).register(c,e);if(f.push(function(a){var b=new o(c);return b.isException?(F.error({message:"Invalid registration model",module:b}),a(new m({type:k.errorTypes.INVALID_REGISTRATION,error:new Error(b.error.message),messages:b.messages,data:c}))):(F.trace("Successfully bound to HilaryModule: "+b.name),a(null,b))}),f.push(function(a,b){D.container.register(a),F.trace("Module registered on container: "+a.name),b(null,a)}),b.function(e))return a.waterfall(f,function(a,b){if(a)return F.error({message:"Registration failed",input:c,err:a}),e(a);F.debug("Registration success: "+b.name),e(a,b)});var g;return a.waterfall(f,{blocking:!0},function(a,b){if(a)return F.error({message:"Registration failed",input:c,err:a}),void(g=a);F.debug("Registration success: "+b.name),g=b}),g}function f(a){return F.trace({message:"Making a registration task",module:a}),function(c,e){var f;if(!c||!c.__isHilaryScope||b.not.function(e))return f=new Error(k.bootstrap.INVALID_TASK_ARGUMENT),F.error({message:k.bootstrap.INVALID_TASK_ARGUMENT,err:f}),arguments[arguments.length-1](new m({type:k.errorTypes.INVALID_REGISTRATION,error:f,messages:[k.bootstrap.INVALID_TASK_ARGUMENT],data:a}));d(a,function(a){if(a)return e(a);e(null,c)})}}function g(a,c){if(F.trace("resolving: "+a),b.regexp(a)){var d=E.filterMatchingRegistrations(a,D).map(function(a){return j(a,a)});if(!b.function(c))return d;c(null,d)}return j(a,a,c)}function j(c,d,e){var f={name:c,relyingName:d,theModule:void 0,resolved:void 0,isResolved:!1,registerSingleton:!0,members:[]},g=[];if(g.push(function(a){a(null,f)}),g.push(E.validateModuleName),g.push(E.findModule),g.push(E.resolveDependencies),g.push(E.reduceMembers),g.push(E.optionallyRegisterSingleton),g.push(E.bindToOutput),!b.function(e)){var h;return a.waterfall(g,{blocking:!0},function(a,b){return a&&a.type===k.errorTypes.MODULE_NOT_FOUND&&D.parent&&s[D.parent]?(F.trace("Attempting to resolve the module, "+f.name+", on the parent scope: "+D.parent),void(h=s[D.parent].resolve(c))):a&&a.type===k.errorTypes.MODULE_NOT_FOUND?(F.trace("Attempting to gracefully degrade, "+f.name),void(h=r(f))):a?(F.error({message:"Resolve failed for: "+f.name,err:a}),void(h=a)):(F.debug("Module resolved: "+f.name),void(h=b))}),h}a.waterfall(g,function(a,b){return a&&a.type===k.errorTypes.MODULE_NOT_FOUND&&D.parent&&s[D.parent]?(F.trace("Attempting to resolve the module, "+f.name+", on the parent scope: "+D.parent),s[D.parent].resolve(c,e)):a&&a.type===k.errorTypes.MODULE_NOT_FOUND?(F.trace("Attempting to gracefully degrade, "+f.name),r(f,e)):a?(F.error({message:"Resolve failed for: "+f.name,err:a}),e(a)):(F.debug("Module resolved: "+f.name),void e(null,b))})}function r(c,d){var e=[];if(e.push(function(a){a(null,c)}),e.push(E.findDegraded),e.push(E.reduceMembers),e.push(E.optionallyRegisterSingleton),e.push(E.bindToOutput),!b.function(d)){var f;return a.waterfall(e,{blocking:!0},function(a,b){if(a)return F.error({message:"Resolve failed for: "+c.name,err:a}),void(f=a);F.debug("Module resolved: "+c.name),f=b}),f}a.waterfall(e,function(a,b){if(a)return F.error({message:"Resolve failed for: "+c.name,err:a}),d(a);F.debug("Module resolved: "+c.name),d(null,b)})}function t(a){return F.debug("Checking if module exists: "+a),D.container.exists(a)}function u(a,c){var d,e;return"function"==typeof a?(F.debug("Disposing all modules on scope, "+C.name),d=null,e=a):(F.debug({message:"Disposing module(s) on scope, "+C.name,moduleNames:a}),d=a,e=c),z(function(){var a;return b.array(d)?(a=D.container.dispose(d).disposed.concat(D.singletonContainer.dispose(d).disposed),{result:a.length===d.length,disposed:a}):D.container.dispose(d)||D.singletonContainer.dispose(d)},new Error,e)}function v(a,b,c){return a=a||i.createUid(8),b=b||{},b.parent=x(C.context.scope===h?b.parent:b.parent||C),s[a]?F.debug("Returning existing scope: "+a):F.debug({message:"Creating new scope: "+a,options:b}),z(function(){return q.scope(a,b)},new Error,c)}function w(a){var b=x(a);return b?(F.debug("Setting the parent scope of, "+C.context.scope+", to: "+b),D.parent=b,D):(F.error("Unable to set the parent scope of, "+C.context.scope+", to: "+b),new m({type:k.errorTypes.INVALID_ARG,error:new Error(k.api.PARENT_CONTAINER_ARG)}))}function x(a){return a?b.string(a)?a:a.__isHilaryScope?a.context.scope:null:null}function y(c,d){var e,f=[],g=b.function(d);return b.defined(c)&&b.not.array(c)&&f.push(function(a){a(new m({type:k.errorTypes.BOOTSTRAP_FAILED,error:new Error(k.bootstrap.TASKS_ARRAY)}))}),g?(F.trace("Using the callback argument for the bootstrapper for: "+C.context.scope),e=d):(F.trace("A callback was not defined for the bootstrapper for: "+C.context.scope),e=function(a){a?F.fatal(new m({type:k.errorTypes.BOOTSTRAP_FAILED,error:a})):F.trace("finished bootstrapping: "+C.context.scope)}),f.push(function(a){F.trace("bootstrapping hilary for: "+C.context.scope),a(null,C)}),Array.isArray(c)&&c.forEach(function(a){b.function(a)&&f.push(a)}),b.defined(c)&&c.length>0&&1===f.length&&f.push(function(a,b){b(new m({type:k.errorTypes.BOOTSTRAP_FAILED,error:new Error(k.bootstrap.TASKS_ARRAY)}))}),1===f.length&&F.trace("no task functions were found in the bootstrapper for: "+C.context.scope),a.waterfall(f,e)}function z(c,d,e){if(!b.function(e))return A(c,d);a.runAsync(function(){var a=A(c,d);a.isException?e(d):e(null,a)})}function A(a,b){try{return a()}catch(a){return b.message+="("+a.message+")",b.cause=a,F.error({message:a.message,err:b}),{err:b,isException:!0}}}function B(a){var c={};return a=a||{},b.string(a)?c.scope=a:b.nullOrUndefined(a.scope)&&(b.string(a.name)?c.scope=a.name:c.scope=i.createUid(8)),c.logging=a.logging||{level:30},b.string(a.parent)?c.parent=a.parent:a.parent&&a.parent.__isHilaryScope&&(c.parent=a.parent.context.scope),c}var C,D,E,F=new l(c),G=new B(c);return D=new n(G),E=new p(D,F,g),D.isException?D:(C={__isHilaryScope:!0,context:D,HilaryModule:o,register:d,makeRegistrationTask:f,resolve:g,exists:t,dispose:u,bootstrap:y,scope:v,setParentScope:w},Object.defineProperty(C,"name",{enumerable:!1,configurable:!1,get:function(){return C.context.scope},set:function(){F.warn(name+" is read only")}}),s[G.scope]=C,C)},q.scope=function(a,b,d){return d="boolean"!=typeof d||d,s[a]?s[a]:(b=b||{},b.name=a,s[a]=new q(b),d&&c(s[a]),s[a])},r=q.scope(h,null,!1),r.Context=n,r.context.singletonContainer.register({name:d,factory:a}),r.context.singletonContainer.register({name:e,singleton:!1,factory:function(){return r.context}}),r.context.singletonContainer.register({name:f,factory:j}),r.context.singletonContainer.register({name:g,factory:b}),c(r),r}function c(a){Object.freeze(a),Object.seal(a.context),Object.seal(a.context.container),Object.seal(a.context.singletonContainer)}var d="polyn::async",e="hilary::context",f="polyn::Immutable",g="polyn::is",h="default";!function(a){try{if("undefined"!=typeof module&&module.exports)module.exports=a.factory;else{if("undefined"==typeof window)throw new Error("[HILARY] Unkown runtime environment");window.__hilary=window.__hilary||{},window.__hilary[a.name]=a.factory}}catch(d){var b=a&&a.name?a.name:"MISSING NAME",c=new Error("[HILARY] Registration failure: "+b);throw c.cause=d,c}}({name:"HilaryApi",factory:b})}(),"undefined"!=typeof window){if(!window.polyn)throw new Error("[HILARY] Hilary depends on polyn. Make sure it is included before loading Hilary (https://github.com/losandes/polyn)");if(!window.__hilary)throw new Error("[HILARY] Hilary modules were loaded out of order");!function(a,b,c){"use strict";var d=b.locale,e=b.Exception,f=b.Container(d,a.is,a.Immutable,e),g=b.Context(a.Immutable,f),h=b.HilaryModule(a.is,a.Blueprint,a.objectHelper,d,e),i=b.Logger(a.is),j=b.ResolveTasks(a.async,a.is,d,e);a.Blueprint.configure({compatibility:"2017-03-20"}),c.hilary=b.HilaryApi(a.async,a.is,a.id,a.Immutable,d,i,e,g,h,j)}(window.polyn,window.__hilary,window)}else{if("undefined"==typeof module||!module.exports)throw new Error("[HILARY] Unkown runtime environment");var polyn=require("polyn"),locale=require("./locale"),Exception=require("./Exception"),Container=require("./Container")(locale,polyn.is,polyn.Immutable,Exception),Context=require("./Context")(polyn.Blueprint,Container,Exception,locale),HilaryModule=require("./HilaryModule")(polyn.is,polyn.Blueprint,polyn.objectHelper,locale,Exception),Logger=require("./Logger")(polyn.is),ResolveTasks=require("./ResolveTasks")(polyn.async,polyn.is,locale,Exception),hilary=require("./HilaryApi")(polyn.async,polyn.is,polyn.id,polyn.Immutable,locale,Logger,Exception,Context,HilaryModule,ResolveTasks);polyn.Blueprint.configure({compatibility:"2017-03-20"}),module.exports=hilary}