@pebula/metap
Version:
meta-programming tools
2 lines • 3.85 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@pebula/utils"),require("@pebula/metap/internal"),require("@pebula/metap")):"function"==typeof define&&define.amd?define("@pebula/metap/testing",["exports","@pebula/utils","@pebula/metap/internal","@pebula/metap"],e):e(((t=t||self).pebula=t.pebula||{},t.pebula.metap=t.pebula.metap||{},t.pebula.metap.testing={}),t.pebula.utils,t.pebula.metap.internal,t.pebula.metap)}(this,function(t,e,r,o){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function a(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=r.targetStore;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.getTargetMeta=function(t){return i.builtTargets.get(t)},e.getModel=function(t){var e=i.getTargetMeta(t);return e&&e.model()},e.clearAll=function(){i.namedTargets.clear(),i.builtTargets.clear(),i.targets.clear(),i.locals.clear()},e.clear=function(t){var e=i.builtTargets.get(t);e&&(i.namedTargets.delete(e.model().resName),i.builtTargets.delete(t),i.targets.get(t).clear())},e}(r.TargetStore),p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.getFactory=function(t){return function(e,r){var o=function(t){return i.getTargetMeta(t)}(e);if(o)return o.config.get(t,r)}},e.removeFactory=function(t){return function(e,r){var o=u.getTargetMeta(e);if(o)return o.config.delete(t,r)}},e.addRelation=function(t,e,r){o.Relation(r)(t.prototype,e)},e.addProp=function(t,e,r){o.Prop(r)(t.prototype,e)},e.setExcludeClass=function(t){o.Exclude()(t)},e.addExclude=function(t,e,r){o.Exclude(r)(t.prototype,e)},e.getRelation=e.getFactory(r.RelationMetadata),e.getProp=e.getFactory(r.PropMetadata),e.getExclude=e.getFactory(r.ExcludeMetadata),e.removeRelation=e.removeFactory(r.RelationMetadata),e.removeProp=e.removeFactory(r.PropMetadata),e.removeExclude=e.removeFactory(r.ExcludeMetadata),e}(r.TargetMetadata);var l=function(){function t(t){this.target=t}return t.prototype.build=function(){i.getTargetMeta(this.target).model().build()},t.prototype.clear=function(){return u.clear(this.target),this},t.prototype.setModel=function(t){return void 0===t&&(t=void 0),this.clear(),o.Model(t)(this.target),this},t.prototype.setIdentity=function(t){return o.Identity()(this.target.prototype,t),this},t.prototype.setExclude=function(t){return t?p.setExcludeClass(this.target):delete i.getTargetMeta(this.target).model().transformStrategy,this},t.prototype.getProp=function(t){return p.getProp(this.target,t)},t.prototype.getType=function(t){return this.getProp(t).type},t.prototype.getRelation=function(t){return p.getRelation(this.target,t)},t.prototype.getExclude=function(t){return p.getExclude(this.target,t)},t.prototype.relation=function(t,e){return p.removeRelation(this.target,t),"boolean"!=typeof e&&p.addRelation(this.target,t.toString(),e),this},t.prototype.prop=function(t,r,o){return p.removeProp(this.target,t),(!o&&e.isFunction(r)||e.isFunction(o))&&Reflect.defineMetadata("design:type",o||r,this.target.prototype,t),"boolean"==typeof r||e.isFunction(r)||p.addProp(this.target,t.toString(),r),this},t.prototype.props=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.forEach(function(e){return t.prop(e)}),this},t.prototype.exclude=function(t,e){return p.removeExclude(this.target,t),"boolean"!=typeof e&&p.addExclude(this.target,t.toString(),e),this},t.create=function(e){return new t(e)},t}();t.TargetMetaModifier=l,t.TestTargetMetadata=p,t.TestTargetStore=u,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=pebula-metap-testing.umd.min.js.map