Comparing version 0.3.0 to 0.4.0
@@ -1,2 +0,2 @@ | ||
var t=function(n,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(n,e)};function n(n,e){function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var e=function(){return(e=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var a in n=arguments[e])Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a]);return t}).apply(this,arguments)};function r(t,n){return Object.prototype.hasOwnProperty.call(n,t)}function a(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return n.reduce(function(t,n){return t&&t[n]?t[n]:null},t)}function u(t,n){for(var a=[],i=2;i<arguments.length;i++)a[i-2]=arguments[i];var o=a[0];if(a.length>1){var c=null!=t&&r(o,t)?t[o]:function(t){return Number.isInteger(t)||t<<0===t}(a[1])?[]:{};n=u.apply(void 0,[c,n].concat(Array.prototype.slice.call(a,1)))}return function(t,n,r){var a=e({},r);return a[t]=n,a}(o,n,t)}var i=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n){return a.apply(void 0,[n].concat(t))}},o=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n,e){return u.apply(void 0,[n,e].concat(t))}},c=function(t){this.operator=t},f=function(t){function e(n){var e=t.call(this)||this;return e.type="FIELD",e.readable=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.join(".")}.apply(void 0,n),e.path=n.slice(),e}return n(e,t),e}(c),s=function(){function t(t){this.get=i.apply(void 0,t),this.set=o.apply(void 0,t),this.metadata=new f(t)}return t.field=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return new t(n)},t}();var l=function(t,n,e){this.type="FUNCTION",this.operator=e,this.body=t,this.readable=null!=n?n:t},p=function(t){function e(n,e,r){var a=t.call(this,e)||this;return a.type="BINARY",a.left=n,a.right=r,a}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.left.readable+" "+this.operator.readable+" "+this.right.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.left,this.right]},e}(c),h={readable:"single_mapping"},d={readable:"when"},w={readable:"validate"},m={readable:"not"},g={readable:"and"},v={readable:"or"},b={readable:"then"},y={readable:"else"},M={readable:"function"},O={readable:"is null"},N={readable:"is not null"},P={readable:"="},A={readable:"!="},I={readable:"match all"},j={readable:"none match"},E={readable:"match any"},_={readable:"contains"},x={readable:"matches"},L={readable:"starts with"},T={readable:"ends with"},V={readable:"length"},C={readable:"as integer"},G={readable:"trimmed"},S={readable:"upper case"},R={readable:"lower case"},U={readable:"concat"},q={readable:"replace all"},W={readable:"sub string"},F={readable:"min"},D={readable:"max"},Y={readable:"sum"},B={readable:"<"},H={readable:"<="},X={readable:">"},k={readable:">="},z={readable:"+"},J={readable:"-"},K={readable:"*"},Q="->",Z=function(t){function e(n,e){var r=t.call(this)||this;return r.type="UNARY",r.metadata=n,r.operator=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.metadata.readable+" "+this.operator.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.metadata]},e}(c),$=function(t){function e(n){var e=t.call(this)||this;return e.type="VALUE",e.readable=String(n),e.value=n,e}return n(e,t),e}(c),tt=function(t){function e(n){var e=t.call(this)||this;return e.type="ITERABLE",e.values=n,e}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return"["+this.values.map(function(t){return t.readable}).join(",")+"]"},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(c),nt=function(){function t(t,n,e){this.metadata=t,this.get=function(t,n){if(r("interceptor",n))return n;var e=function(e,r){var a=n(e,r);return r&&r.addGetValue(t,a),a};return e.interceptor=!0,e}(t,n),this.set=e?function(t,n){if(r("interceptor",n))return n;var e=function(e,r,a){return a&&a.addSetValue(t,r),n(e,r,a)};return e.interceptor=!0,e}(t,e):void 0}return t.function=function(n){return new t(n.metadata,n.get,n.set)},t.contextual=function(n,e){return new t(n,e)},t.consumer=function(n,e){return new t(n,function(){return null},e)},t.lift=function(t,n){return new t(new $(n),function(){return n})},t.prototype.mapTo=function(t,n){var e=this;return new t(new p(this.metadata,M,new l(n.toString())),function(t,r){return n(e.get(t,r))})},t.prototype.isNull=function(){var t=this;return new rt(new Z(this.metadata,O),function(n,e){return null===t.get(n,e)})},t.prototype.isNotNull=function(){var t=this;return new rt(new Z(this.metadata,N),function(n,e){return null!==t.get(n,e)})},t.prototype.eq=function(n){var e=this;return n instanceof t?new rt(new p(this.metadata,P,n.metadata),function(t,r){return e.get(t,r)===n.get(t,r)}):new rt(new p(this.metadata,P,new $(n)),function(t,r){return e.get(t,r)===n})},t.prototype.notEq=function(n){var e=this;return n instanceof t?new rt(new p(this.metadata,A,n.metadata),function(t,r){return e.get(t,r)!==n.get(t,r)}):new rt(new p(this.metadata,A,new $(n)),function(t,r){return e.get(t,r)!==n})},t.prototype.matchAll=function(){for(var n=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=e.map(function(n){return n instanceof t?n.metadata:new $(n)});return new rt(new p(this.metadata,I,new tt(a)),function(r,a){return e.every(function(e){return e instanceof t?n.get(r,a)===e.get(r,a):n.get(r,a)===e})})},t.prototype.noneMatch=function(){for(var n=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=e.map(function(n){return n instanceof t?n.metadata:new $(n)});return new rt(new p(this.metadata,j,new tt(a)),function(r,a){return e.every(function(e){return e instanceof t?n.get(r,a)!==e.get(r,a):n.get(r,a)!==e})})},t.prototype.matchAny=function(){for(var n=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=e.map(function(n){return n instanceof t?n.metadata:new $(n)});return new rt(new p(this.metadata,E,new tt(a)),function(r,a){return e.some(function(e){return e instanceof t?n.get(r,a)===e.get(r,a):n.get(r,a)===e})})},t}();function et(t,n,e,r){return n instanceof nt?function(a,u){var i=t.get(a,u);if(null!=i){var o=n.get(a,u);return null!=o?e(i,o):r}return r}:function(a,u){var i=t.get(a,u);return null!=i?e(i,n):r}}var rt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.boolean=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.not=function(){return new e(new Z(this.metadata,m),et(this,!1,function(t){return!t},!1))},e.prototype.and=function(t){var n=this;return new e(new p(this.metadata,g,t.metadata),function(e,r){if(r&&r.shortCircuit){var a=n.get(e,r);if(null!=a){if(!a)return!1;var u=t.get(e,r);return a&&null!=u&&u}return!1}return et(n,t,function(t,n){return t&&n},!1)(e,r)})},e.prototype.or=function(t){var n=this;return new e(new p(this.metadata,v,t instanceof e?t.metadata:new $(t)),function(r,a){if(a&&a.shortCircuit){var u=n.get(r,a);return null!=u&&(!!u||(t instanceof e?u||t.get(r,a):u||t))}return et(n,t,function(t,n){return t||n},!1)(r,a)})},e}(nt),at=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.number=function(t){return new e(t.metadata,t.get,t.set)},e.min=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new $(t)});return new e(new Z(new tt(r),F),function(n,e){var r=function(t,n){return t<n?t:n};return t.reduce(function(t,a){if(a instanceof nt){var u=a.get(n,e);return null!=u?r(u,t):t}return r(a,t)},Number.MAX_SAFE_INTEGER)})},e.max=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new $(t)});return new e(new Z(new tt(r),D),function(n,e){var r=function(t,n){return t>n?t:n};return t.reduce(function(t,a){if(a instanceof nt){var u=a.get(n,e);return null!=u?r(u,t):t}return r(a,t)},Number.MIN_SAFE_INTEGER)})},e.sum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new $(t)});return new e(new Z(new tt(r),Y),function(n,e){var r=function(t,n){return t+n};return t.reduce(function(t,a){if(a instanceof nt){var u=a.get(n,e);return null!=u?r(u,t):t}return r(a,t)},0)})},e.prototype.lesserThan=function(t){var n=function(t,n){return t<n};return new rt(new p(this.metadata,B,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.lesserOrEquals=function(t){var n=function(t,n){return t<=n};return new rt(new p(this.metadata,H,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.greaterThan=function(t){var n=function(t,n){return t>n};return new rt(new p(this.metadata,X,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.greaterOrEquals=function(t){var n=function(t,n){return t>=n};return new rt(new p(this.metadata,k,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.between=function(t,n){return this.greaterOrEquals(t).and(this.lesserThan(n))},e.prototype.plus=function(t){var n=function(t,n){return t+n};return new e(new p(this.metadata,z,t instanceof e?t.metadata:new $(t)),et(this,t,n,null))},e.prototype.minus=function(t){var n=function(t,n){return t-n};return new e(new p(this.metadata,J,t instanceof e?t.metadata:new $(t)),et(this,t,n,null))},e.prototype.times=function(t){var n=function(t,n){return t*n};return new e(t instanceof e?new p(this.metadata,J,t.metadata):new p(this.metadata,K,new $(t)),et(this,t,n,null))},e}(nt),ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.string=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.contains=function(t){var n=function(t,n){return t.includes(n)};return new rt(new p(this.metadata,_,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.matches=function(t){var n=function(t,n){var e=t.match(n);return null!=e&&e.length>=1};return new rt(new p(this.metadata,x,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.startsWith=function(t){var n=function(t,n){return t.startsWith(n)};return new rt(new p(this.metadata,L,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.endsWith=function(t){var n=function(t,n){return t.endsWith(n)};return new rt(new p(this.metadata,T,t instanceof e?t.metadata:new $(t)),et(this,t,n,!1))},e.prototype.length=function(){return new at(new Z(this.metadata,V),et(this,"",function(t,n){return t.length},0))},e.prototype.parseInt=function(){return new at(new Z(this.metadata,C),et(this,"",function(t,n){return parseInt(t)},null))},e.prototype.trim=function(){return new e(new Z(this.metadata,G),et(this,"",function(t,n){return t.trim()},null))},e.prototype.replaceAll=function(t,n){return new e(new p(this.metadata,q,new p(new $(t),g,new $(n))),et(this,"",function(e,r){return e.replace(t,n)},null))},e.prototype.substring=function(t,n){return new e(new p(this.metadata,W,new p(new $(t),g,new $(n))),et(this,"",function(e,r){return e.substring(t,n)},null))},e.prototype.localeUpperCase=function(){return new e(new Z(this.metadata,S),et(this,"",function(t,n){return t.toLocaleUpperCase()},null))},e.prototype.localeLowerCase=function(){return new e(new Z(this.metadata,R),et(this,"",function(t,n){return t.toLocaleLowerCase()},null))},e.prototype.concat=function(t){return new e(new p(this.metadata,U,t instanceof e?t.metadata:new $(t)),et(this,t,function(t,n){return t+n},null))},e}(nt),it=function(t,n){this.value=t,this.context=n},ot=function(){function t(t){void 0===t&&(t=!0),this.props={},this.getValues=[],this.setValues=[],this.shortCircuit=t}return t.prototype.addGetValue=function(t,n){this.getValues.push({metadata:t,value:n})},t.prototype.addSetValue=function(t,n){this.setValues.push({metadata:t,value:n})},t}(),ct=function(t){function e(n){var e=t.call(this,w)||this;return e.type="VALIDATION",e.when=n,e}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.operator.readable+" "+this.when.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.when]},e}(c),ft=function(){function t(t){this.when=t,this.metadata=new ct(t.metadata)}return t.prototype.execute=function(t,n){void 0===t&&(t={});var e=n||new ot;return new it(this.when.condition.get(t,e),e)},t}(),st=function(t){function e(n,e,r){var a=t.call(this)||this;return a.type="CONDITIONAL_MAPPING",a.whenMetadata=n,a.thenMetadata=e,a.elseMetadata=r,a}return n(e,t),e.prototype.children=function(){var t=[this.whenMetadata,this.thenMetadata];return null!=this.elseMetadata?t.concat(this.elseMetadata):t},Object.defineProperty(e.prototype,"readable",{get:function(){return this.whenMetadata.readable+" "+b.readable+" "+this.thenMetadata.readable+(null!=this.elseMetadata?" "+y.readable+" "+this.elseMetadata.readable:"")},enumerable:!0,configurable:!0}),e}(c),lt=function(){function t(t){this.type="WHEN",this.metadata=t,this.operator=d}return Object.defineProperty(t.prototype,"readable",{get:function(){return this.operator.readable+" "+this.metadata.readable},enumerable:!0,configurable:!0}),t.prototype.children=function(){return[this.metadata]},t}(),pt=function(t){function e(n,e){var r=t.call(this,e)||this;return r.type="MULTIPLE_MAPPING",r.mappings=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.mappings.map(function(t){return t.readable}).join(" , ")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.mappings},e}(c),ht=function(){function t(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];this.condition=t,this.mappings=n;var r=n.map(function(t){return t.metadata});this.metadata=new st(new lt(t.metadata),new pt(r,b))}return t.prototype.execute=function(t,n){return this.condition.get(t,n)?this.mappings.reduce(function(t,e){return e.execute(t,n)},t):this.elseMappings?this.elseMappings.reduce(function(t,e){return e.execute(t,n)},t):t},t.prototype.otherwise=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.elseMappings=t;var e=t.map(function(t){return t.metadata});return this.metadata=new st(this.metadata.whenMetadata,this.metadata.thenMetadata,new pt(e,y)),this},t}(),dt=function(){function t(t){this.condition=t,this.metadata=new lt(t.metadata)}return t.prototype.validate=function(){return new ft(this)},t.prototype.then=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new(ht.bind.apply(ht,[void 0,this.condition].concat(t)))},t}(),wt=function(t){function e(n,e){var r=t.call(this,h)||this;return r.type="SINGLE_MAPPING",r.sourceMetadata=n,r.targetMetadata=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.sourceMetadata.readable+" "+Q+" "+this.targetMetadata.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.sourceMetadata,this.targetMetadata]},e}(c),mt=function(){function t(t,n){this.input=t,this.output=n,this.metadata=new wt(t.metadata,n.metadata)}return t.prototype.execute=function(t,n){var e=n||new ot;return this.output.set?this.output.set(t,this.input.get(t,e),e):t},t}(),gt=function(){function t(t){this.input=t}return t.prototype.to=function(t){return new mt(this.input,t)},t}(),vt=function(){function t(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.mappings=n.flatMap(function(n){return n instanceof t?n.mappings:[n]}),this.metadata=new pt(this.mappings.map(function(t){return t.metadata}))}return t.prototype.execute=function(t,n){return this.mappings.reduce(function(t,e){return e.execute(t,n)},t)},t}(),bt=function(t){function e(n,e){var r=t.call(this,e)||this;return r.type="NARY",r.values=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.values.map(function(t){return t.readable}).join(",")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(c);function yt(t){return nt.function(t)}function Mt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return s.field.apply(s,t)}function Ot(t,n){return nt.lift(t,n)}function Nt(t){return rt.boolean(t)}function Pt(t){return ut.string(t)}function At(t){return at.number(t)}function It(t){return new dt(t)}function jt(t){return new gt(t)}function Et(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new(vt.bind.apply(vt,[void 0].concat(t)))}function _t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new rt(new bt(t.map(function(t){return t.metadata}),E),function(n,e){return t.some(function(t){var r=t.get(n,e);return null!=r&&r})})}function xt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new rt(new bt(t.map(function(t){return t.metadata}),I),function(n,e){return t.every(function(t){var r=t.get(n,e);return null!=r&&r})})}function Lt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new rt(new bt(t.map(function(t){return t.metadata}),j),function(n,e){return t.every(function(t){var r=t.get(n,e);return null!=r&&!r})})}export{Nt as boolean,yt as f,Mt as field,Ot as lift,jt as map,Et as mappings,xt as matchAll,_t as matchAny,Lt as matchNone,At as number,Pt as string,It as when}; | ||
var t=function(n,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(n,e)};function n(n,e){function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var e=function(){return(e=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var a in n=arguments[e])Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a]);return t}).apply(this,arguments)};function r(t,n){return Object.prototype.hasOwnProperty.call(n,t)}function a(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return n.reduce(function(t,n){return t&&void 0!==t[n]?t[n]:void 0},t)}function i(t,n){for(var a=[],u=2;u<arguments.length;u++)a[u-2]=arguments[u];var o=a[0];if(a.length>1){var c=null!=t&&r(o,t)?t[o]:function(t){return Number.isInteger(t)||t<<0===t}(a[1])?[]:{};n=i.apply(void 0,[c,n].concat(Array.prototype.slice.call(a,1)))}return function(t,n,r){var a=e({},r);return a[t]=n,a}(o,n,t)}var u=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n){return a.apply(void 0,[n].concat(t))}},o=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n,e){return i.apply(void 0,[n,e].concat(t))}},c=function(t){this.operator=t},s=function(t){function e(n){var e=t.call(this)||this;return e.type="FIELD",e.readable=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.join(".")}.apply(void 0,n),e.path=n.slice(),e}return n(e,t),e}(c),f=function(){function t(t){this.get=u.apply(void 0,t),this.set=o.apply(void 0,t),this.metadata=new s(t)}return t.field=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return new t(n)},t}();var l=function(t,n,e){this.type="FUNCTION",this.operator=e,this.body=t,this.readable=null!=n?n:t},h=function(t){function e(n,e,r){var a=t.call(this,e)||this;return a.type="BINARY",a.left=n,a.right=r,a}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.left.readable+" "+this.operator.readable+" "+this.right.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.left,this.right]},e}(c),p={readable:"single_mapping"},d={readable:"when"},w={readable:"validate"},m={readable:"not"},v={readable:"and"},g={readable:"or"},b={readable:"then"},y={readable:"else"},M={readable:"function"},O={readable:"has value"},N={readable:"is null"},P={readable:"is not null"},A={readable:"is defined"},I={readable:"is undefined"},j={readable:"="},E={readable:"!="},_={readable:"match all"},x={readable:"none match"},L={readable:"match any"},T={readable:"contains"},V={readable:"matches"},C={readable:"starts with"},U={readable:"ends with"},G={readable:"length"},S={readable:"as integer"},R={readable:"trimmed"},q={readable:"upper case"},W={readable:"lower case"},D={readable:"concat"},F={readable:"replace all"},Y={readable:"sub string"},B={readable:"min"},H={readable:"max"},X={readable:"sum"},k={readable:"<"},z={readable:"<="},J={readable:">"},K={readable:">="},Q={readable:"+"},Z={readable:"-"},$={readable:"*"},tt="->",nt=function(t){function e(n,e){var r=t.call(this)||this;return r.type="UNARY",r.metadata=n,r.operator=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.metadata.readable+" "+this.operator.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.metadata]},e}(c),et=function(t){function e(n){var e=t.call(this)||this;return e.type="VALUE",e.readable=String(n),e.value=n,e}return n(e,t),e}(c),rt=function(t){function e(n){var e=t.call(this)||this;return e.type="ITERABLE",e.values=n,e}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return"["+this.values.map(function(t){return t.readable}).join(",")+"]"},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(c),at=function(){function t(t,n,e){this.metadata=t,this.get=function(t,n){if(r("interceptor",n))return n;var e=function(e,r){var a=n(e,r);return r&&r.addGetValue(t,a),a};return e.interceptor=!0,e}(t,n),this.set=e?function(t,n){if(r("interceptor",n))return n;var e=function(e,r,a){return a&&a.addSetValue(t,r),n(e,r,a)};return e.interceptor=!0,e}(t,e):void 0}return t.function=function(n){return new t(n.metadata,n.get,n.set)},t.contextual=function(n,e){return new t(n,e)},t.consumer=function(n,e){return new t(n,function(){return null},e)},t.lift=function(t,n){return new t(new et(n),function(){return n})},t.prototype.mapTo=function(t,n){var e=this;return new t(new h(this.metadata,M,new l(n.toString())),function(t,r){return n(e.get(t,r))})},t.prototype.hasValue=function(){var t=this;return new ut(new nt(this.metadata,O),function(n,e){var r=t.get(n,e);return null!=r})},t.prototype.isNullOrUndefined=function(){return this.isNull().or(this.isUndefined())},t.prototype.isDefined=function(){var t=this;return new ut(new nt(this.metadata,A),function(n,e){return void 0!==t.get(n,e)})},t.prototype.isUndefined=function(){var t=this;return new ut(new nt(this.metadata,I),function(n,e){return void 0===t.get(n,e)})},t.prototype.isNull=function(){var t=this;return new ut(new nt(this.metadata,N),function(n,e){return null===t.get(n,e)})},t.prototype.isNotNull=function(){var t=this;return new ut(new nt(this.metadata,P),function(n,e){return null!==t.get(n,e)})},t.prototype.eq=function(n){var e=this;return n instanceof t?new ut(new h(this.metadata,j,n.metadata),function(t,r){return e.get(t,r)===n.get(t,r)}):new ut(new h(this.metadata,j,new et(n)),function(t,r){return e.get(t,r)===n})},t.prototype.notEq=function(n){var e=this;return n instanceof t?new ut(new h(this.metadata,E,n.metadata),function(t,r){return e.get(t,r)!==n.get(t,r)}):new ut(new h(this.metadata,E,new et(n)),function(t,r){return e.get(t,r)!==n})},t.prototype.matchAll=function(){for(var n=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=e.map(function(n){return n instanceof t?n.metadata:new et(n)});return new ut(new h(this.metadata,_,new rt(a)),function(r,a){return e.every(function(e){return e instanceof t?n.get(r,a)===e.get(r,a):n.get(r,a)===e})})},t.prototype.noneMatch=function(){for(var n=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=e.map(function(n){return n instanceof t?n.metadata:new et(n)});return new ut(new h(this.metadata,x,new rt(a)),function(r,a){return e.every(function(e){return e instanceof t?n.get(r,a)!==e.get(r,a):n.get(r,a)!==e})})},t.prototype.matchAny=function(){for(var n=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=e.map(function(n){return n instanceof t?n.metadata:new et(n)});return new ut(new h(this.metadata,L,new rt(a)),function(r,a){return e.some(function(e){return e instanceof t?n.get(r,a)===e.get(r,a):n.get(r,a)===e})})},t}();function it(t,n,e,r){return n instanceof at?function(a,i){var u=t.get(a,i);if(null!=u){var o=n.get(a,i);return null!=o||null!=o?e(u,o):r}return r}:function(a,i){var u=t.get(a,i);return null!=u||null!=u?e(u,n):r}}var ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.boolean=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.not=function(){return new e(new nt(this.metadata,m),it(this,!1,function(t){return!t},!1))},e.prototype.and=function(t){var n=this;return new e(new h(this.metadata,v,t.metadata),function(e,r){if(r&&r.shortCircuit){var a=n.get(e,r);if(null!=a){if(!a)return!1;var i=t.get(e,r);return a&&null!=i&&i}return!1}return it(n,t,function(t,n){return t&&n},!1)(e,r)})},e.prototype.or=function(t){var n=this;return new e(new h(this.metadata,g,t instanceof e?t.metadata:new et(t)),function(r,a){if(a&&a.shortCircuit){var i=n.get(r,a);return null!=i&&(!!i||(t instanceof e?i||t.get(r,a):i||t))}return it(n,t,function(t,n){return t||n},!1)(r,a)})},e}(at),ot=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.number=function(t){return new e(t.metadata,t.get,t.set)},e.min=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new et(t)});return new e(new nt(new rt(r),B),function(n,e){var r=function(t,n){return t<n?t:n};return t.reduce(function(t,a){if(a instanceof at){var i=a.get(n,e);return null!=i?r(i,t):t}return r(a,t)},Number.MAX_SAFE_INTEGER)})},e.max=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new et(t)});return new e(new nt(new rt(r),H),function(n,e){var r=function(t,n){return t>n?t:n};return t.reduce(function(t,a){if(a instanceof at){var i=a.get(n,e);return null!=i?r(i,t):t}return r(a,t)},Number.MIN_SAFE_INTEGER)})},e.sum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new et(t)});return new e(new nt(new rt(r),X),function(n,e){var r=function(t,n){return t+n};return t.reduce(function(t,a){if(a instanceof at){var i=a.get(n,e);return null!=i?r(i,t):t}return r(a,t)},0)})},e.prototype.lesserThan=function(t){var n=function(t,n){return t<n};return new ut(new h(this.metadata,k,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.lesserOrEquals=function(t){var n=function(t,n){return t<=n};return new ut(new h(this.metadata,z,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.greaterThan=function(t){var n=function(t,n){return t>n};return new ut(new h(this.metadata,J,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.greaterOrEquals=function(t){var n=function(t,n){return t>=n};return new ut(new h(this.metadata,K,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.between=function(t,n){return this.greaterOrEquals(t).and(this.lesserThan(n))},e.prototype.plus=function(t){var n=function(t,n){return t+n};return new e(new h(this.metadata,Q,t instanceof e?t.metadata:new et(t)),it(this,t,n,null))},e.prototype.minus=function(t){var n=function(t,n){return t-n};return new e(new h(this.metadata,Z,t instanceof e?t.metadata:new et(t)),it(this,t,n,null))},e.prototype.times=function(t){var n=function(t,n){return t*n};return new e(t instanceof e?new h(this.metadata,Z,t.metadata):new h(this.metadata,$,new et(t)),it(this,t,n,null))},e}(at),ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.string=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.contains=function(t){var n=function(t,n){return t.includes(n)};return new ut(new h(this.metadata,T,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.matches=function(t){var n=function(t,n){var e=t.match(n);return null!=e&&e.length>=1};return new ut(new h(this.metadata,V,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.startsWith=function(t){var n=function(t,n){return t.startsWith(n)};return new ut(new h(this.metadata,C,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.endsWith=function(t){var n=function(t,n){return t.endsWith(n)};return new ut(new h(this.metadata,U,t instanceof e?t.metadata:new et(t)),it(this,t,n,!1))},e.prototype.length=function(){return new ot(new nt(this.metadata,G),it(this,"",function(t,n){return t.length},0))},e.prototype.parseInt=function(){return new ot(new nt(this.metadata,S),it(this,"",function(t,n){return parseInt(t)},null))},e.prototype.trim=function(){return new e(new nt(this.metadata,R),it(this,"",function(t,n){return t.trim()},null))},e.prototype.replaceAll=function(t,n){return new e(new h(this.metadata,F,new h(new et(t),v,new et(n))),it(this,"",function(e,r){return e.replace(t,n)},null))},e.prototype.substring=function(t,n){return new e(new h(this.metadata,Y,new h(new et(t),v,new et(n))),it(this,"",function(e,r){return e.substring(t,n)},null))},e.prototype.localeUpperCase=function(){return new e(new nt(this.metadata,q),it(this,"",function(t,n){return t.toLocaleUpperCase()},null))},e.prototype.localeLowerCase=function(){return new e(new nt(this.metadata,W),it(this,"",function(t,n){return t.toLocaleLowerCase()},null))},e.prototype.concat=function(t){return new e(new h(this.metadata,D,t instanceof e?t.metadata:new et(t)),it(this,t,function(t,n){return t+n},null))},e}(at),st=function(t,n){this.value=t,this.context=n},ft=function(){function t(t){void 0===t&&(t=!0),this.props={},this.getValues=[],this.setValues=[],this.shortCircuit=t}return t.prototype.addGetValue=function(t,n){this.getValues.push({metadata:t,value:n})},t.prototype.addSetValue=function(t,n){this.setValues.push({metadata:t,value:n})},t}(),lt=function(t){function e(n){var e=t.call(this,w)||this;return e.type="VALIDATION",e.when=n,e}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.operator.readable+" "+this.when.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.when]},e}(c),ht=function(){function t(t){this.when=t,this.metadata=new lt(t.metadata)}return t.prototype.execute=function(t,n){void 0===t&&(t={});var e=n||new ft;return new st(this.when.condition.get(t,e),e)},t}(),pt=function(t){function e(n,e,r){var a=t.call(this)||this;return a.type="CONDITIONAL_MAPPING",a.whenMetadata=n,a.thenMetadata=e,a.elseMetadata=r,a}return n(e,t),e.prototype.children=function(){var t=[this.whenMetadata,this.thenMetadata];return null!=this.elseMetadata?t.concat(this.elseMetadata):t},Object.defineProperty(e.prototype,"readable",{get:function(){return this.whenMetadata.readable+" "+b.readable+" "+this.thenMetadata.readable+(null!=this.elseMetadata?" "+y.readable+" "+this.elseMetadata.readable:"")},enumerable:!0,configurable:!0}),e}(c),dt=function(){function t(t){this.type="WHEN",this.metadata=t,this.operator=d}return Object.defineProperty(t.prototype,"readable",{get:function(){return this.operator.readable+" "+this.metadata.readable},enumerable:!0,configurable:!0}),t.prototype.children=function(){return[this.metadata]},t}(),wt=function(t){function e(n,e){var r=t.call(this,e)||this;return r.type="MULTIPLE_MAPPING",r.mappings=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.mappings.map(function(t){return t.readable}).join(" , ")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.mappings},e}(c),mt=function(){function t(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];this.condition=t,this.mappings=n;var r=n.map(function(t){return t.metadata});this.metadata=new pt(new dt(t.metadata),new wt(r,b))}return t.prototype.execute=function(t,n){return this.condition.get(t,n)?this.mappings.reduce(function(t,e){return e.execute(t,n)},t):this.elseMappings?this.elseMappings.reduce(function(t,e){return e.execute(t,n)},t):t},t.prototype.otherwise=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.elseMappings=t;var e=t.map(function(t){return t.metadata});return this.metadata=new pt(this.metadata.whenMetadata,this.metadata.thenMetadata,new wt(e,y)),this},t}(),vt=function(){function t(t){this.condition=t,this.metadata=new dt(t.metadata)}return t.prototype.validate=function(){return new ht(this)},t.prototype.then=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new(mt.bind.apply(mt,[void 0,this.condition].concat(t)))},t}(),gt=function(t){function e(n,e){var r=t.call(this,p)||this;return r.type="SINGLE_MAPPING",r.sourceMetadata=n,r.targetMetadata=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.sourceMetadata.readable+" "+tt+" "+this.targetMetadata.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.sourceMetadata,this.targetMetadata]},e}(c),bt=function(){function t(t,n){this.input=t,this.output=n,this.metadata=new gt(t.metadata,n.metadata)}return t.prototype.execute=function(t,n){var e=n||new ft;return this.output.set?this.output.set(t,this.input.get(t,e),e):t},t}(),yt=function(){function t(t){this.input=t}return t.prototype.to=function(t){return new bt(this.input,t)},t}(),Mt=function(){function t(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.mappings=n.flatMap(function(n){return n instanceof t?n.mappings:[n]}),this.metadata=new wt(this.mappings.map(function(t){return t.metadata}))}return t.prototype.execute=function(t,n){return this.mappings.reduce(function(t,e){return e.execute(t,n)},t)},t}(),Ot=function(t){function e(n,e){var r=t.call(this,e)||this;return r.type="NARY",r.values=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.values.map(function(t){return t.readable}).join(",")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(c);function Nt(t){return at.function(t)}function Pt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return f.field.apply(f,t)}function At(t,n){return at.lift(t,n)}function It(t){return ut.boolean(t)}function jt(t){return ct.string(t)}function Et(t){return ot.number(t)}function _t(t){return new vt(t)}function xt(t){return new yt(t)}function Lt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new(Mt.bind.apply(Mt,[void 0].concat(t)))}function Tt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new ut(new Ot(t.map(function(t){return t.metadata}),L),function(n,e){return t.some(function(t){var r=t.get(n,e);return null!=r&&r})})}function Vt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new ut(new Ot(t.map(function(t){return t.metadata}),_),function(n,e){return t.every(function(t){var r=t.get(n,e);return null!=r&&r})})}function Ct(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new ut(new Ot(t.map(function(t){return t.metadata}),x),function(n,e){return t.every(function(t){var r=t.get(n,e);return null!=r&&!r})})}export{It as boolean,Nt as f,Pt as field,At as lift,xt as map,Lt as mappings,Vt as matchAll,Tt as matchAny,Ct as matchNone,Et as number,jt as string,_t as when}; | ||
//# sourceMappingURL=doov.es.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).doov={})}(this,function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function a(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function i(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(t,e){return t&&t[e]?t[e]:null},t)}function u(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=n[0];if(n.length>1){var c=null!=t&&a(o,t)?t[o]:function(t){return Number.isInteger(t)||t<<0===t}(n[1])?[]:{};e=u.apply(void 0,[c,e].concat(Array.prototype.slice.call(n,1)))}return function(t,e,n){var a=r({},n);return a[t]=e,a}(o,e,t)}var o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return i.apply(void 0,[e].concat(t))}},c=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e,n){return u.apply(void 0,[e,n].concat(t))}},f=function(t){this.operator=t},s=function(t){function e(e){var n=t.call(this)||this;return n.type="FIELD",n.readable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.join(".")}.apply(void 0,e),n.path=e.slice(),n}return n(e,t),e}(f),l=function(){function t(t){this.get=o.apply(void 0,t),this.set=c.apply(void 0,t),this.metadata=new s(t)}return t.field=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(e)},t}();var p=function(t,e,n){this.type="FUNCTION",this.operator=n,this.body=t,this.readable=null!=e?e:t},h=function(t){function e(e,n,r){var a=t.call(this,n)||this;return a.type="BINARY",a.left=e,a.right=r,a}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.left.readable+" "+this.operator.readable+" "+this.right.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.left,this.right]},e}(f),d={readable:"single_mapping"},w={readable:"when"},m={readable:"validate"},g={readable:"not"},b={readable:"and"},v={readable:"or"},y={readable:"then"},M={readable:"else"},O={readable:"function"},N={readable:"is null"},A={readable:"is not null"},P={readable:"="},j={readable:"!="},I={readable:"match all"},_={readable:"none match"},E={readable:"match any"},x={readable:"contains"},L={readable:"matches"},T={readable:"starts with"},V={readable:"ends with"},C={readable:"length"},G={readable:"as integer"},S={readable:"trimmed"},R={readable:"upper case"},U={readable:"lower case"},q={readable:"concat"},W={readable:"replace all"},F={readable:"sub string"},D={readable:"min"},Y={readable:"max"},B={readable:"sum"},H={readable:"<"},X={readable:"<="},k={readable:">"},z={readable:">="},J={readable:"+"},K={readable:"-"},Q={readable:"*"},Z="->",$=function(t){function e(e,n){var r=t.call(this)||this;return r.type="UNARY",r.metadata=e,r.operator=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.metadata.readable+" "+this.operator.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.metadata]},e}(f),tt=function(t){function e(e){var n=t.call(this)||this;return n.type="VALUE",n.readable=String(e),n.value=e,n}return n(e,t),e}(f),et=function(t){function e(e){var n=t.call(this)||this;return n.type="ITERABLE",n.values=e,n}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return"["+this.values.map(function(t){return t.readable}).join(",")+"]"},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(f),nt=function(){function t(t,e,n){this.metadata=t,this.get=function(t,e){if(a("interceptor",e))return e;var n=function(n,r){var a=e(n,r);return r&&r.addGetValue(t,a),a};return n.interceptor=!0,n}(t,e),this.set=n?function(t,e){if(a("interceptor",e))return e;var n=function(n,r,a){return a&&a.addSetValue(t,r),e(n,r,a)};return n.interceptor=!0,n}(t,n):void 0}return t.function=function(e){return new t(e.metadata,e.get,e.set)},t.contextual=function(e,n){return new t(e,n)},t.consumer=function(e,n){return new t(e,function(){return null},n)},t.lift=function(t,e){return new t(new tt(e),function(){return e})},t.prototype.mapTo=function(t,e){var n=this;return new t(new h(this.metadata,O,new p(e.toString())),function(t,r){return e(n.get(t,r))})},t.prototype.isNull=function(){var t=this;return new at(new $(this.metadata,N),function(e,n){return null===t.get(e,n)})},t.prototype.isNotNull=function(){var t=this;return new at(new $(this.metadata,A),function(e,n){return null!==t.get(e,n)})},t.prototype.eq=function(e){var n=this;return e instanceof t?new at(new h(this.metadata,P,e.metadata),function(t,r){return n.get(t,r)===e.get(t,r)}):new at(new h(this.metadata,P,new tt(e)),function(t,r){return n.get(t,r)===e})},t.prototype.notEq=function(e){var n=this;return e instanceof t?new at(new h(this.metadata,j,e.metadata),function(t,r){return n.get(t,r)!==e.get(t,r)}):new at(new h(this.metadata,j,new tt(e)),function(t,r){return n.get(t,r)!==e})},t.prototype.matchAll=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=n.map(function(e){return e instanceof t?e.metadata:new tt(e)});return new at(new h(this.metadata,I,new et(a)),function(r,a){return n.every(function(n){return n instanceof t?e.get(r,a)===n.get(r,a):e.get(r,a)===n})})},t.prototype.noneMatch=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=n.map(function(e){return e instanceof t?e.metadata:new tt(e)});return new at(new h(this.metadata,_,new et(a)),function(r,a){return n.every(function(n){return n instanceof t?e.get(r,a)!==n.get(r,a):e.get(r,a)!==n})})},t.prototype.matchAny=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=n.map(function(e){return e instanceof t?e.metadata:new tt(e)});return new at(new h(this.metadata,E,new et(a)),function(r,a){return n.some(function(n){return n instanceof t?e.get(r,a)===n.get(r,a):e.get(r,a)===n})})},t}();function rt(t,e,n,r){return e instanceof nt?function(a,i){var u=t.get(a,i);if(null!=u){var o=e.get(a,i);return null!=o?n(u,o):r}return r}:function(a,i){var u=t.get(a,i);return null!=u?n(u,e):r}}var at=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.boolean=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.not=function(){return new e(new $(this.metadata,g),rt(this,!1,function(t){return!t},!1))},e.prototype.and=function(t){var n=this;return new e(new h(this.metadata,b,t.metadata),function(e,r){if(r&&r.shortCircuit){var a=n.get(e,r);if(null!=a){if(!a)return!1;var i=t.get(e,r);return a&&null!=i&&i}return!1}return rt(n,t,function(t,e){return t&&e},!1)(e,r)})},e.prototype.or=function(t){var n=this;return new e(new h(this.metadata,v,t instanceof e?t.metadata:new tt(t)),function(r,a){if(a&&a.shortCircuit){var i=n.get(r,a);return null!=i&&(!!i||(t instanceof e?i||t.get(r,a):i||t))}return rt(n,t,function(t,e){return t||e},!1)(r,a)})},e}(nt),it=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.number=function(t){return new e(t.metadata,t.get,t.set)},e.min=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new tt(t)});return new e(new $(new et(r),D),function(e,n){var r=function(t,e){return t<e?t:e};return t.reduce(function(t,a){if(a instanceof nt){var i=a.get(e,n);return null!=i?r(i,t):t}return r(a,t)},Number.MAX_SAFE_INTEGER)})},e.max=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new tt(t)});return new e(new $(new et(r),Y),function(e,n){var r=function(t,e){return t>e?t:e};return t.reduce(function(t,a){if(a instanceof nt){var i=a.get(e,n);return null!=i?r(i,t):t}return r(a,t)},Number.MIN_SAFE_INTEGER)})},e.sum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new tt(t)});return new e(new $(new et(r),B),function(e,n){var r=function(t,e){return t+e};return t.reduce(function(t,a){if(a instanceof nt){var i=a.get(e,n);return null!=i?r(i,t):t}return r(a,t)},0)})},e.prototype.lesserThan=function(t){var n=function(t,e){return t<e};return new at(new h(this.metadata,H,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.lesserOrEquals=function(t){var n=function(t,e){return t<=e};return new at(new h(this.metadata,X,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.greaterThan=function(t){var n=function(t,e){return t>e};return new at(new h(this.metadata,k,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.greaterOrEquals=function(t){var n=function(t,e){return t>=e};return new at(new h(this.metadata,z,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.between=function(t,e){return this.greaterOrEquals(t).and(this.lesserThan(e))},e.prototype.plus=function(t){var n=function(t,e){return t+e};return new e(new h(this.metadata,J,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,null))},e.prototype.minus=function(t){var n=function(t,e){return t-e};return new e(new h(this.metadata,K,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,null))},e.prototype.times=function(t){var n=function(t,e){return t*e};return new e(t instanceof e?new h(this.metadata,K,t.metadata):new h(this.metadata,Q,new tt(t)),rt(this,t,n,null))},e}(nt),ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.string=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.contains=function(t){var n=function(t,e){return t.includes(e)};return new at(new h(this.metadata,x,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.matches=function(t){var n=function(t,e){var n=t.match(e);return null!=n&&n.length>=1};return new at(new h(this.metadata,L,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.startsWith=function(t){var n=function(t,e){return t.startsWith(e)};return new at(new h(this.metadata,T,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.endsWith=function(t){var n=function(t,e){return t.endsWith(e)};return new at(new h(this.metadata,V,t instanceof e?t.metadata:new tt(t)),rt(this,t,n,!1))},e.prototype.length=function(){return new it(new $(this.metadata,C),rt(this,"",function(t,e){return t.length},0))},e.prototype.parseInt=function(){return new it(new $(this.metadata,G),rt(this,"",function(t,e){return parseInt(t)},null))},e.prototype.trim=function(){return new e(new $(this.metadata,S),rt(this,"",function(t,e){return t.trim()},null))},e.prototype.replaceAll=function(t,n){return new e(new h(this.metadata,W,new h(new tt(t),b,new tt(n))),rt(this,"",function(e,r){return e.replace(t,n)},null))},e.prototype.substring=function(t,n){return new e(new h(this.metadata,F,new h(new tt(t),b,new tt(n))),rt(this,"",function(e,r){return e.substring(t,n)},null))},e.prototype.localeUpperCase=function(){return new e(new $(this.metadata,R),rt(this,"",function(t,e){return t.toLocaleUpperCase()},null))},e.prototype.localeLowerCase=function(){return new e(new $(this.metadata,U),rt(this,"",function(t,e){return t.toLocaleLowerCase()},null))},e.prototype.concat=function(t){return new e(new h(this.metadata,q,t instanceof e?t.metadata:new tt(t)),rt(this,t,function(t,e){return t+e},null))},e}(nt),ot=function(t,e){this.value=t,this.context=e},ct=function(){function t(t){void 0===t&&(t=!0),this.props={},this.getValues=[],this.setValues=[],this.shortCircuit=t}return t.prototype.addGetValue=function(t,e){this.getValues.push({metadata:t,value:e})},t.prototype.addSetValue=function(t,e){this.setValues.push({metadata:t,value:e})},t}(),ft=function(t){function e(e){var n=t.call(this,m)||this;return n.type="VALIDATION",n.when=e,n}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.operator.readable+" "+this.when.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.when]},e}(f),st=function(){function t(t){this.when=t,this.metadata=new ft(t.metadata)}return t.prototype.execute=function(t,e){void 0===t&&(t={});var n=e||new ct;return new ot(this.when.condition.get(t,n),n)},t}(),lt=function(t){function e(e,n,r){var a=t.call(this)||this;return a.type="CONDITIONAL_MAPPING",a.whenMetadata=e,a.thenMetadata=n,a.elseMetadata=r,a}return n(e,t),e.prototype.children=function(){var t=[this.whenMetadata,this.thenMetadata];return null!=this.elseMetadata?t.concat(this.elseMetadata):t},Object.defineProperty(e.prototype,"readable",{get:function(){return this.whenMetadata.readable+" "+y.readable+" "+this.thenMetadata.readable+(null!=this.elseMetadata?" "+M.readable+" "+this.elseMetadata.readable:"")},enumerable:!0,configurable:!0}),e}(f),pt=function(){function t(t){this.type="WHEN",this.metadata=t,this.operator=w}return Object.defineProperty(t.prototype,"readable",{get:function(){return this.operator.readable+" "+this.metadata.readable},enumerable:!0,configurable:!0}),t.prototype.children=function(){return[this.metadata]},t}(),ht=function(t){function e(e,n){var r=t.call(this,n)||this;return r.type="MULTIPLE_MAPPING",r.mappings=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.mappings.map(function(t){return t.readable}).join(" , ")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.mappings},e}(f),dt=function(){function t(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.condition=t,this.mappings=e;var r=e.map(function(t){return t.metadata});this.metadata=new lt(new pt(t.metadata),new ht(r,y))}return t.prototype.execute=function(t,e){return this.condition.get(t,e)?this.mappings.reduce(function(t,n){return n.execute(t,e)},t):this.elseMappings?this.elseMappings.reduce(function(t,n){return n.execute(t,e)},t):t},t.prototype.otherwise=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.elseMappings=t;var n=t.map(function(t){return t.metadata});return this.metadata=new lt(this.metadata.whenMetadata,this.metadata.thenMetadata,new ht(n,M)),this},t}(),wt=function(){function t(t){this.condition=t,this.metadata=new pt(t.metadata)}return t.prototype.validate=function(){return new st(this)},t.prototype.then=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(dt.bind.apply(dt,[void 0,this.condition].concat(t)))},t}(),mt=function(t){function e(e,n){var r=t.call(this,d)||this;return r.type="SINGLE_MAPPING",r.sourceMetadata=e,r.targetMetadata=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.sourceMetadata.readable+" "+Z+" "+this.targetMetadata.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.sourceMetadata,this.targetMetadata]},e}(f),gt=function(){function t(t,e){this.input=t,this.output=e,this.metadata=new mt(t.metadata,e.metadata)}return t.prototype.execute=function(t,e){var n=e||new ct;return this.output.set?this.output.set(t,this.input.get(t,n),n):t},t}(),bt=function(){function t(t){this.input=t}return t.prototype.to=function(t){return new gt(this.input,t)},t}(),vt=function(){function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.mappings=e.flatMap(function(e){return e instanceof t?e.mappings:[e]}),this.metadata=new ht(this.mappings.map(function(t){return t.metadata}))}return t.prototype.execute=function(t,e){return this.mappings.reduce(function(t,n){return n.execute(t,e)},t)},t}(),yt=function(t){function e(e,n){var r=t.call(this,n)||this;return r.type="NARY",r.values=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.values.map(function(t){return t.readable}).join(",")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(f);t.boolean=function(t){return at.boolean(t)},t.f=function(t){return nt.function(t)},t.field=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return l.field.apply(l,t)},t.lift=function(t,e){return nt.lift(t,e)},t.map=function(t){return new bt(t)},t.mappings=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(vt.bind.apply(vt,[void 0].concat(t)))},t.matchAll=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new at(new yt(t.map(function(t){return t.metadata}),I),function(e,n){return t.every(function(t){var r=t.get(e,n);return null!=r&&r})})},t.matchAny=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new at(new yt(t.map(function(t){return t.metadata}),E),function(e,n){return t.some(function(t){var r=t.get(e,n);return null!=r&&r})})},t.matchNone=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new at(new yt(t.map(function(t){return t.metadata}),_),function(e,n){return t.every(function(t){var r=t.get(e,n);return null!=r&&!r})})},t.number=function(t){return it.number(t)},t.string=function(t){return ut.string(t)},t.when=function(t){return new wt(t)},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).doov={})}(this,function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function a(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function i(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(t,e){return t&&void 0!==t[e]?t[e]:void 0},t)}function u(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=n[0];if(n.length>1){var c=null!=t&&a(o,t)?t[o]:function(t){return Number.isInteger(t)||t<<0===t}(n[1])?[]:{};e=u.apply(void 0,[c,e].concat(Array.prototype.slice.call(n,1)))}return function(t,e,n){var a=r({},n);return a[t]=e,a}(o,e,t)}var o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return i.apply(void 0,[e].concat(t))}},c=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e,n){return u.apply(void 0,[e,n].concat(t))}},f=function(t){this.operator=t},s=function(t){function e(e){var n=t.call(this)||this;return n.type="FIELD",n.readable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.join(".")}.apply(void 0,e),n.path=e.slice(),n}return n(e,t),e}(f),l=function(){function t(t){this.get=o.apply(void 0,t),this.set=c.apply(void 0,t),this.metadata=new s(t)}return t.field=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(e)},t}();var p=function(t,e,n){this.type="FUNCTION",this.operator=n,this.body=t,this.readable=null!=e?e:t},h=function(t){function e(e,n,r){var a=t.call(this,n)||this;return a.type="BINARY",a.left=e,a.right=r,a}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.left.readable+" "+this.operator.readable+" "+this.right.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.left,this.right]},e}(f),d={readable:"single_mapping"},w={readable:"when"},m={readable:"validate"},v={readable:"not"},g={readable:"and"},b={readable:"or"},y={readable:"then"},M={readable:"else"},O={readable:"function"},N={readable:"has value"},A={readable:"is null"},P={readable:"is not null"},j={readable:"is defined"},I={readable:"is undefined"},_={readable:"="},E={readable:"!="},x={readable:"match all"},L={readable:"none match"},T={readable:"match any"},V={readable:"contains"},C={readable:"matches"},U={readable:"starts with"},G={readable:"ends with"},S={readable:"length"},R={readable:"as integer"},q={readable:"trimmed"},W={readable:"upper case"},D={readable:"lower case"},F={readable:"concat"},Y={readable:"replace all"},B={readable:"sub string"},H={readable:"min"},X={readable:"max"},k={readable:"sum"},z={readable:"<"},J={readable:"<="},K={readable:">"},Q={readable:">="},Z={readable:"+"},$={readable:"-"},tt={readable:"*"},et="->",nt=function(t){function e(e,n){var r=t.call(this)||this;return r.type="UNARY",r.metadata=e,r.operator=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.metadata.readable+" "+this.operator.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.metadata]},e}(f),rt=function(t){function e(e){var n=t.call(this)||this;return n.type="VALUE",n.readable=String(e),n.value=e,n}return n(e,t),e}(f),at=function(t){function e(e){var n=t.call(this)||this;return n.type="ITERABLE",n.values=e,n}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return"["+this.values.map(function(t){return t.readable}).join(",")+"]"},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(f),it=function(){function t(t,e,n){this.metadata=t,this.get=function(t,e){if(a("interceptor",e))return e;var n=function(n,r){var a=e(n,r);return r&&r.addGetValue(t,a),a};return n.interceptor=!0,n}(t,e),this.set=n?function(t,e){if(a("interceptor",e))return e;var n=function(n,r,a){return a&&a.addSetValue(t,r),e(n,r,a)};return n.interceptor=!0,n}(t,n):void 0}return t.function=function(e){return new t(e.metadata,e.get,e.set)},t.contextual=function(e,n){return new t(e,n)},t.consumer=function(e,n){return new t(e,function(){return null},n)},t.lift=function(t,e){return new t(new rt(e),function(){return e})},t.prototype.mapTo=function(t,e){var n=this;return new t(new h(this.metadata,O,new p(e.toString())),function(t,r){return e(n.get(t,r))})},t.prototype.hasValue=function(){var t=this;return new ot(new nt(this.metadata,N),function(e,n){var r=t.get(e,n);return null!=r})},t.prototype.isNullOrUndefined=function(){return this.isNull().or(this.isUndefined())},t.prototype.isDefined=function(){var t=this;return new ot(new nt(this.metadata,j),function(e,n){return void 0!==t.get(e,n)})},t.prototype.isUndefined=function(){var t=this;return new ot(new nt(this.metadata,I),function(e,n){return void 0===t.get(e,n)})},t.prototype.isNull=function(){var t=this;return new ot(new nt(this.metadata,A),function(e,n){return null===t.get(e,n)})},t.prototype.isNotNull=function(){var t=this;return new ot(new nt(this.metadata,P),function(e,n){return null!==t.get(e,n)})},t.prototype.eq=function(e){var n=this;return e instanceof t?new ot(new h(this.metadata,_,e.metadata),function(t,r){return n.get(t,r)===e.get(t,r)}):new ot(new h(this.metadata,_,new rt(e)),function(t,r){return n.get(t,r)===e})},t.prototype.notEq=function(e){var n=this;return e instanceof t?new ot(new h(this.metadata,E,e.metadata),function(t,r){return n.get(t,r)!==e.get(t,r)}):new ot(new h(this.metadata,E,new rt(e)),function(t,r){return n.get(t,r)!==e})},t.prototype.matchAll=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=n.map(function(e){return e instanceof t?e.metadata:new rt(e)});return new ot(new h(this.metadata,x,new at(a)),function(r,a){return n.every(function(n){return n instanceof t?e.get(r,a)===n.get(r,a):e.get(r,a)===n})})},t.prototype.noneMatch=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=n.map(function(e){return e instanceof t?e.metadata:new rt(e)});return new ot(new h(this.metadata,L,new at(a)),function(r,a){return n.every(function(n){return n instanceof t?e.get(r,a)!==n.get(r,a):e.get(r,a)!==n})})},t.prototype.matchAny=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=n.map(function(e){return e instanceof t?e.metadata:new rt(e)});return new ot(new h(this.metadata,T,new at(a)),function(r,a){return n.some(function(n){return n instanceof t?e.get(r,a)===n.get(r,a):e.get(r,a)===n})})},t}();function ut(t,e,n,r){return e instanceof it?function(a,i){var u=t.get(a,i);if(null!=u){var o=e.get(a,i);return null!=o||null!=o?n(u,o):r}return r}:function(a,i){var u=t.get(a,i);return null!=u||null!=u?n(u,e):r}}var ot=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.boolean=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.not=function(){return new e(new nt(this.metadata,v),ut(this,!1,function(t){return!t},!1))},e.prototype.and=function(t){var n=this;return new e(new h(this.metadata,g,t.metadata),function(e,r){if(r&&r.shortCircuit){var a=n.get(e,r);if(null!=a){if(!a)return!1;var i=t.get(e,r);return a&&null!=i&&i}return!1}return ut(n,t,function(t,e){return t&&e},!1)(e,r)})},e.prototype.or=function(t){var n=this;return new e(new h(this.metadata,b,t instanceof e?t.metadata:new rt(t)),function(r,a){if(a&&a.shortCircuit){var i=n.get(r,a);return null!=i&&(!!i||(t instanceof e?i||t.get(r,a):i||t))}return ut(n,t,function(t,e){return t||e},!1)(r,a)})},e}(it),ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.number=function(t){return new e(t.metadata,t.get,t.set)},e.min=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new rt(t)});return new e(new nt(new at(r),H),function(e,n){var r=function(t,e){return t<e?t:e};return t.reduce(function(t,a){if(a instanceof it){var i=a.get(e,n);return null!=i?r(i,t):t}return r(a,t)},Number.MAX_SAFE_INTEGER)})},e.max=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new rt(t)});return new e(new nt(new at(r),X),function(e,n){var r=function(t,e){return t>e?t:e};return t.reduce(function(t,a){if(a instanceof it){var i=a.get(e,n);return null!=i?r(i,t):t}return r(a,t)},Number.MIN_SAFE_INTEGER)})},e.sum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(t){return t instanceof e?t.metadata:new rt(t)});return new e(new nt(new at(r),k),function(e,n){var r=function(t,e){return t+e};return t.reduce(function(t,a){if(a instanceof it){var i=a.get(e,n);return null!=i?r(i,t):t}return r(a,t)},0)})},e.prototype.lesserThan=function(t){var n=function(t,e){return t<e};return new ot(new h(this.metadata,z,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.lesserOrEquals=function(t){var n=function(t,e){return t<=e};return new ot(new h(this.metadata,J,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.greaterThan=function(t){var n=function(t,e){return t>e};return new ot(new h(this.metadata,K,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.greaterOrEquals=function(t){var n=function(t,e){return t>=e};return new ot(new h(this.metadata,Q,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.between=function(t,e){return this.greaterOrEquals(t).and(this.lesserThan(e))},e.prototype.plus=function(t){var n=function(t,e){return t+e};return new e(new h(this.metadata,Z,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,null))},e.prototype.minus=function(t){var n=function(t,e){return t-e};return new e(new h(this.metadata,$,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,null))},e.prototype.times=function(t){var n=function(t,e){return t*e};return new e(t instanceof e?new h(this.metadata,$,t.metadata):new h(this.metadata,tt,new rt(t)),ut(this,t,n,null))},e}(it),ft=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.string=function(t){return new e(t.metadata,t.get,t.set)},e.prototype.contains=function(t){var n=function(t,e){return t.includes(e)};return new ot(new h(this.metadata,V,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.matches=function(t){var n=function(t,e){var n=t.match(e);return null!=n&&n.length>=1};return new ot(new h(this.metadata,C,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.startsWith=function(t){var n=function(t,e){return t.startsWith(e)};return new ot(new h(this.metadata,U,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.endsWith=function(t){var n=function(t,e){return t.endsWith(e)};return new ot(new h(this.metadata,G,t instanceof e?t.metadata:new rt(t)),ut(this,t,n,!1))},e.prototype.length=function(){return new ct(new nt(this.metadata,S),ut(this,"",function(t,e){return t.length},0))},e.prototype.parseInt=function(){return new ct(new nt(this.metadata,R),ut(this,"",function(t,e){return parseInt(t)},null))},e.prototype.trim=function(){return new e(new nt(this.metadata,q),ut(this,"",function(t,e){return t.trim()},null))},e.prototype.replaceAll=function(t,n){return new e(new h(this.metadata,Y,new h(new rt(t),g,new rt(n))),ut(this,"",function(e,r){return e.replace(t,n)},null))},e.prototype.substring=function(t,n){return new e(new h(this.metadata,B,new h(new rt(t),g,new rt(n))),ut(this,"",function(e,r){return e.substring(t,n)},null))},e.prototype.localeUpperCase=function(){return new e(new nt(this.metadata,W),ut(this,"",function(t,e){return t.toLocaleUpperCase()},null))},e.prototype.localeLowerCase=function(){return new e(new nt(this.metadata,D),ut(this,"",function(t,e){return t.toLocaleLowerCase()},null))},e.prototype.concat=function(t){return new e(new h(this.metadata,F,t instanceof e?t.metadata:new rt(t)),ut(this,t,function(t,e){return t+e},null))},e}(it),st=function(t,e){this.value=t,this.context=e},lt=function(){function t(t){void 0===t&&(t=!0),this.props={},this.getValues=[],this.setValues=[],this.shortCircuit=t}return t.prototype.addGetValue=function(t,e){this.getValues.push({metadata:t,value:e})},t.prototype.addSetValue=function(t,e){this.setValues.push({metadata:t,value:e})},t}(),pt=function(t){function e(e){var n=t.call(this,m)||this;return n.type="VALIDATION",n.when=e,n}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.operator.readable+" "+this.when.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.when]},e}(f),ht=function(){function t(t){this.when=t,this.metadata=new pt(t.metadata)}return t.prototype.execute=function(t,e){void 0===t&&(t={});var n=e||new lt;return new st(this.when.condition.get(t,n),n)},t}(),dt=function(t){function e(e,n,r){var a=t.call(this)||this;return a.type="CONDITIONAL_MAPPING",a.whenMetadata=e,a.thenMetadata=n,a.elseMetadata=r,a}return n(e,t),e.prototype.children=function(){var t=[this.whenMetadata,this.thenMetadata];return null!=this.elseMetadata?t.concat(this.elseMetadata):t},Object.defineProperty(e.prototype,"readable",{get:function(){return this.whenMetadata.readable+" "+y.readable+" "+this.thenMetadata.readable+(null!=this.elseMetadata?" "+M.readable+" "+this.elseMetadata.readable:"")},enumerable:!0,configurable:!0}),e}(f),wt=function(){function t(t){this.type="WHEN",this.metadata=t,this.operator=w}return Object.defineProperty(t.prototype,"readable",{get:function(){return this.operator.readable+" "+this.metadata.readable},enumerable:!0,configurable:!0}),t.prototype.children=function(){return[this.metadata]},t}(),mt=function(t){function e(e,n){var r=t.call(this,n)||this;return r.type="MULTIPLE_MAPPING",r.mappings=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.mappings.map(function(t){return t.readable}).join(" , ")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.mappings},e}(f),vt=function(){function t(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.condition=t,this.mappings=e;var r=e.map(function(t){return t.metadata});this.metadata=new dt(new wt(t.metadata),new mt(r,y))}return t.prototype.execute=function(t,e){return this.condition.get(t,e)?this.mappings.reduce(function(t,n){return n.execute(t,e)},t):this.elseMappings?this.elseMappings.reduce(function(t,n){return n.execute(t,e)},t):t},t.prototype.otherwise=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.elseMappings=t;var n=t.map(function(t){return t.metadata});return this.metadata=new dt(this.metadata.whenMetadata,this.metadata.thenMetadata,new mt(n,M)),this},t}(),gt=function(){function t(t){this.condition=t,this.metadata=new wt(t.metadata)}return t.prototype.validate=function(){return new ht(this)},t.prototype.then=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(vt.bind.apply(vt,[void 0,this.condition].concat(t)))},t}(),bt=function(t){function e(e,n){var r=t.call(this,d)||this;return r.type="SINGLE_MAPPING",r.sourceMetadata=e,r.targetMetadata=n,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.sourceMetadata.readable+" "+et+" "+this.targetMetadata.readable},enumerable:!0,configurable:!0}),e.prototype.children=function(){return[this.sourceMetadata,this.targetMetadata]},e}(f),yt=function(){function t(t,e){this.input=t,this.output=e,this.metadata=new bt(t.metadata,e.metadata)}return t.prototype.execute=function(t,e){var n=e||new lt;return this.output.set?this.output.set(t,this.input.get(t,n),n):t},t}(),Mt=function(){function t(t){this.input=t}return t.prototype.to=function(t){return new yt(this.input,t)},t}(),Ot=function(){function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.mappings=e.flatMap(function(e){return e instanceof t?e.mappings:[e]}),this.metadata=new mt(this.mappings.map(function(t){return t.metadata}))}return t.prototype.execute=function(t,e){return this.mappings.reduce(function(t,n){return n.execute(t,e)},t)},t}(),Nt=function(t){function e(e,n){var r=t.call(this,n)||this;return r.type="NARY",r.values=e,r}return n(e,t),Object.defineProperty(e.prototype,"readable",{get:function(){return this.values.map(function(t){return t.readable}).join(",")},enumerable:!0,configurable:!0}),e.prototype.children=function(){return this.values},e}(f);t.boolean=function(t){return ot.boolean(t)},t.f=function(t){return it.function(t)},t.field=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return l.field.apply(l,t)},t.lift=function(t,e){return it.lift(t,e)},t.map=function(t){return new Mt(t)},t.mappings=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(Ot.bind.apply(Ot,[void 0].concat(t)))},t.matchAll=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new ot(new Nt(t.map(function(t){return t.metadata}),x),function(e,n){return t.every(function(t){var r=t.get(e,n);return null!=r&&r})})},t.matchAny=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new ot(new Nt(t.map(function(t){return t.metadata}),T),function(e,n){return t.some(function(t){var r=t.get(e,n);return null!=r&&r})})},t.matchNone=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new ot(new Nt(t.map(function(t){return t.metadata}),L),function(e,n){return t.every(function(t){var r=t.get(e,n);return null!=r&&!r})})},t.number=function(t){return ct.number(t)},t.string=function(t){return ft.string(t)},t.when=function(t){return new gt(t)},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=doov.js.map |
import { Metadata } from 'dsl/meta/Metadata'; | ||
export interface ValueAccess { | ||
metadata: Metadata; | ||
value: any; | ||
value: unknown; | ||
} | ||
@@ -13,4 +13,4 @@ export interface Context { | ||
setValues: ValueAccess[]; | ||
addGetValue(metadata: Metadata, value: any): void; | ||
addSetValue(metadata: Metadata, value: any): void; | ||
addGetValue(metadata: Metadata, value: unknown): void; | ||
addSetValue(metadata: Metadata, value: unknown): void; | ||
} |
@@ -6,4 +6,4 @@ import { Context } from 'dsl/Context'; | ||
export interface ContextAccessor<T extends object, C extends Context, V> extends DslBuilder { | ||
get: Getter<T, C, V | null>; | ||
set?: Setter<T, C, V | null>; | ||
get: Getter<T, C, V | null | undefined>; | ||
set?: Setter<T, C, V | null | undefined>; | ||
} |
@@ -11,4 +11,4 @@ import { Context, ValueAccess } from 'dsl/Context'; | ||
constructor(shortCircuit?: boolean); | ||
addGetValue(metadata: Metadata, value: any): void; | ||
addSetValue(metadata: Metadata, value: any): void; | ||
addGetValue(metadata: Metadata, value: unknown): void; | ||
addSetValue(metadata: Metadata, value: unknown): void; | ||
} |
@@ -7,4 +7,4 @@ import { ContextAccessor } from 'dsl/ContextAccessor'; | ||
export declare class Field<T extends object = object, C extends Context = Context, V = {}> implements ContextAccessor<T, C, V> { | ||
get: Getter<T, C, V | null>; | ||
set: Setter<T, C, V | null>; | ||
get: Getter<T, C, V | null | undefined>; | ||
set: Setter<T, C, V | null | undefined>; | ||
readonly metadata: FieldMetadata; | ||
@@ -11,0 +11,0 @@ constructor(path: (string | number)[]); |
@@ -11,4 +11,7 @@ import { Operator } from 'dsl/Operator'; | ||
export declare const FUNCTION: Operator; | ||
export declare const HAS_VALUE: Operator; | ||
export declare const IS_NULL: Operator; | ||
export declare const IS_NOT_NULL: Operator; | ||
export declare const IS_DEFINED: Operator; | ||
export declare const IS_UNDEFINED: Operator; | ||
export declare const EQ: Operator; | ||
@@ -15,0 +18,0 @@ export declare const NOT_EQ: Operator; |
@@ -10,13 +10,17 @@ import { ContextAccessor } from 'dsl/ContextAccessor'; | ||
export declare class Function<T> implements ContextAccessor<object, Context, T>, DslBuilder { | ||
get: Getter<object, Context, T | null>; | ||
set?: Setter<object, Context, T | null>; | ||
get: Getter<object, Context, T | null | undefined>; | ||
set?: Setter<object, Context, T | null | undefined>; | ||
readonly metadata: Metadata; | ||
constructor(metadata: Metadata, getter: Getter<object, Context, T | null>, setter?: Setter<object, Context, T | null>); | ||
constructor(metadata: Metadata, getter: Getter<object, Context, T | null | undefined>, setter?: Setter<object, Context, T | null | undefined>); | ||
static function<T>(accessor: ContextAccessor<object, Context, T>): Function<T>; | ||
static contextual<U>(metadata: Metadata, getter: Getter<object, Context, U | null>): Function<U>; | ||
static consumer<U>(metadata: Metadata, setter: Setter<object, Context, U | null>): Function<U>; | ||
static consumer<U>(metadata: Metadata, setter: Setter<object, Context, U | null | undefined>): Function<U>; | ||
static lift<U, F extends Function<U>>(constructor: FunctionConstructor<U, F>, value: U): F; | ||
mapTo<U, F extends Function<U>>(constructor: FunctionConstructor<U, F>, f: { | ||
(v: T | null): U; | ||
(v: T | null | undefined): U; | ||
}): F; | ||
hasValue(): BooleanFunction; | ||
isNullOrUndefined(): BooleanFunction; | ||
isDefined(): BooleanFunction; | ||
isUndefined(): BooleanFunction; | ||
isNull(): BooleanFunction; | ||
@@ -23,0 +27,0 @@ isNotNull(): BooleanFunction; |
import { Context } from 'dsl/Context'; | ||
export declare class Result { | ||
value: boolean | null; | ||
value: boolean | null | undefined; | ||
context: Context; | ||
constructor(value: boolean | null, context: Context); | ||
constructor(value: boolean | null | undefined, context: Context); | ||
} |
import { Context } from 'dsl/Context'; | ||
import { Metadata } from 'dsl/meta/Metadata'; | ||
export interface Getter<T extends object = object, C extends Context = Context, V = any> { | ||
export interface Getter<T extends object = object, C extends Context = Context, V = unknown> { | ||
(obj: T, ctx?: C): V; | ||
} | ||
export declare function interceptGetter<T extends object = object, C extends Context = Context, V = any>(metadata: Metadata, getter: Getter<T, C, V>): Getter<T, C, V>; | ||
export declare function interceptGetter<T extends object = object, C extends Context = Context, V = unknown>(metadata: Metadata, getter: Getter<T, C, V>): Getter<T, C, V>; |
@@ -38,3 +38,3 @@ import { Context } from 'dsl/Context'; | ||
*/ | ||
export declare function setProp<T>(prop: string | number, val: any, obj: T): T; | ||
export declare function setProp<T>(prop: string | number, val: unknown, obj: T): T; | ||
/** | ||
@@ -46,3 +46,3 @@ * Set Property with promise | ||
*/ | ||
export declare function setPropPromise<T>(prop: string | number, val: Promise<any>, obj: T): Promise<T>; | ||
export declare function setPropPromise<T>(prop: string | number, val: Promise<unknown>, obj: T): Promise<T>; | ||
/** | ||
@@ -54,3 +54,3 @@ * Set to Path with promise | ||
*/ | ||
export declare function setPathPromise<T extends object>(obj: T, val: Promise<any>, ...path: (string | number)[]): Promise<T>; | ||
export declare function setPathPromise<T extends object>(obj: T, val: Promise<unknown>, ...path: (string | number)[]): Promise<T>; | ||
/** | ||
@@ -62,3 +62,3 @@ * Set to Path with promise using value | ||
*/ | ||
export declare function setPathPromiseValue<T extends object>(obj: T, val: any, ...path: (string | number)[]): Promise<T>; | ||
export declare function setPathPromiseValue<T extends object>(obj: T, val: unknown, ...path: (string | number)[]): Promise<T>; | ||
/** | ||
@@ -70,3 +70,3 @@ * Set to Path without promise | ||
*/ | ||
export declare function setPath<T extends object>(obj: T, val: any, ...path: (string | number)[]): T; | ||
export declare function setPath<T extends object>(obj: T, val: unknown, ...path: (string | number)[]): T; | ||
/** | ||
@@ -73,0 +73,0 @@ * Getter |
import { Context } from 'dsl/Context'; | ||
import { Metadata } from 'dsl/meta/Metadata'; | ||
export interface Setter<T extends object = object, C extends Context = Context, V = any> { | ||
export interface Setter<T extends object = object, C extends Context = Context, V = unknown> { | ||
(obj: T, val: V, ctx?: C): T; | ||
} | ||
export declare function interceptSetter<T extends object = object, C extends Context = Context, V = any>(metadata: Metadata, setter: Setter<T, C, V>): Setter<T, C, V>; | ||
export declare function interceptSetter<T extends object = object, C extends Context = Context, V = unknown>(metadata: Metadata, setter: Setter<T, C, V>): Setter<T, C, V>; |
@@ -1,3 +0,2 @@ | ||
export declare function log(message: string): void; | ||
export declare function hasProperty(prop: string | number | symbol, obj: object): boolean; | ||
export declare function isInteger(obj: any): obj is number; |
{ | ||
"name": "doov", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"desciption": "dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping", | ||
@@ -5,0 +5,0 @@ "homepage": "https://doov.io", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
213601
663
0