@politie/sherlock-proxy
Advanced tools
Comparing version 3.3.8 to 3.3.9
{ | ||
"name": "@politie/sherlock-proxy", | ||
"version": "3.3.8", | ||
"version": "3.3.9", | ||
"description": "A proxy extension to Sherlock.", | ||
@@ -41,4 +41,4 @@ "main": "sherlock-proxy.cjs.js", | ||
"peerDependencies": { | ||
"@politie/sherlock": "3.3.8" | ||
"@politie/sherlock": "3.3.9" | ||
} | ||
} |
@@ -108,3 +108,3 @@ import { Derivable, ReactorOptions } from '@politie/sherlock'; | ||
*/ | ||
$pluckableKeys(): (string | number | symbol)[]; | ||
$pluckableKeys(): (string | symbol)[]; | ||
/** | ||
@@ -111,0 +111,0 @@ * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration |
@@ -54,3 +54,3 @@ 'use strict'; | ||
// istanbul ignore next: for debug purposes | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -69,3 +69,3 @@ }, | ||
catch (e) { | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -87,3 +87,3 @@ }, | ||
// istanbul ignore next: for debug purposes | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -102,3 +102,3 @@ }, | ||
catch (e) { | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -105,0 +105,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("@politie/sherlock"),e=Symbol("isDerivableProxy");function n(r){return!0===r[e]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,e){if(!e)return r;var n=e.get,i=e.set;return i&&t.isSettableDerivable(r)?t.lens({get:n,set:function(t,e){r.set(i.call(this,t,e))}},r).autoCache():r.derive(n).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(t){throw Object.assign(Error("error while getting "+(r.$expression||"$value")+": "+(t&&t.message)),{jse_cause:t})}},set:function(r){var e=this.$proxyDescriptor,n=e.$derivable,i=e.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$value")+" is readonly");try{n.set(r)}catch(r){throw Object.assign(Error("error while setting "+(i||"$value")+": "+(r&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(t){throw Object.assign(Error("error while getting "+(r.$expression||"$targetValue")+": "+(t&&t.message)),{jse_cause:t})}},set:function(r){var e=this.$proxyDescriptor,n=e.$target,i=e.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$targetValue")+" is readonly");try{n.set(r)}catch(r){throw Object.assign(Error("error while setting "+(i||"$targetValue")+": "+(r&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(r,e,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter((function(r){return r.startsWith("$$")})).forEach((function(r){return i[r]=void 0})),i.$expression=e,i.$path=n,new Proxy(i,o)},e.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),s(t.$expression,r),a(t.$path,r))},e.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},e.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},e.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(u(r))},e.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(u(r))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(u(r))},e.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},e.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var t,e,n,i;return r.__generator(this,(function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error((n||"object")+" is not iterable"),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function u(r){return n(r)?r.$derivable:r}i.prototype[e]=!0;var o={get:function(r,t,e){return"$proxyDescriptor"===t?r:c(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,e,i,u){if(c(r,e)){var o=r.$pluck.call(u,e);return i&&n(i)?o.$targetValue=i.$targetValue:o.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(r,e,i,u)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():c(r,t)},getOwnPropertyDescriptor:function(r,t){if(c(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function c(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function s(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function a(r,t){return void 0===r&&(r=[]),r.concat(t)}exports.ProxyDescriptor=i,exports.extendExpression=s,exports.extendPath=a,exports.isDerivableProxy=n,exports.unwrapProxy=u; | ||
Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("@politie/sherlock"),e=Symbol("isDerivableProxy");function n(r){return!0===r[e]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,e){if(!e)return r;var n=e.get,i=e.set;return i&&t.isSettableDerivable(r)?t.lens({get:n,set:function(t,e){r.set(i.call(this,t,e))}},r).autoCache():r.derive(n).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(e){throw Object.assign(Error("error while getting "+(r.$expression||"$value")+": "+(t._internal.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var e=this.$proxyDescriptor,n=e.$derivable,i=e.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$value")+" is readonly");try{n.set(r)}catch(r){throw Object.assign(Error("error while setting "+(i||"$value")+": "+(t._internal.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(e){throw Object.assign(Error("error while getting "+(r.$expression||"$targetValue")+": "+(t._internal.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var e=this.$proxyDescriptor,n=e.$target,i=e.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$targetValue")+" is readonly");try{n.set(r)}catch(r){throw Object.assign(Error("error while setting "+(i||"$targetValue")+": "+(t._internal.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(r,e,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter((function(r){return r.startsWith("$$")})).forEach((function(r){return i[r]=void 0})),i.$expression=e,i.$path=n,new Proxy(i,o)},e.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),s(t.$expression,r),a(t.$path,r))},e.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},e.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},e.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(u(r))},e.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(u(r))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(u(r))},e.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},e.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var t,e,n,i;return r.__generator(this,(function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error((n||"object")+" is not iterable"),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function u(r){return n(r)?r.$derivable:r}i.prototype[e]=!0;var o={get:function(r,t,e){return"$proxyDescriptor"===t?r:c(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,e,i,u){if(c(r,e)){var o=r.$pluck.call(u,e);return i&&n(i)?o.$targetValue=i.$targetValue:o.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(r,e,i,u)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():c(r,t)},getOwnPropertyDescriptor:function(r,t){if(c(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function c(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function s(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function a(r,t){return void 0===r&&(r=[]),r.concat(t)}exports.ProxyDescriptor=i,exports.extendExpression=s,exports.extendPath=a,exports.isDerivableProxy=n,exports.unwrapProxy=u; | ||
//# sourceMappingURL=sherlock-proxy.cjs.min.js.map |
import { __generator } from 'tslib'; | ||
import { isSettableDerivable, utils, lens, isDerivable } from '@politie/sherlock'; | ||
import { _internal, isSettableDerivable, utils, lens, isDerivable } from '@politie/sherlock'; | ||
@@ -50,3 +50,3 @@ var IS_DERIVABLE_PROXY = Symbol('isDerivableProxy'); | ||
// istanbul ignore next: for debug purposes | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (_internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -65,3 +65,3 @@ }, | ||
catch (e) { | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (_internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -83,3 +83,3 @@ }, | ||
// istanbul ignore next: for debug purposes | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (_internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -98,3 +98,3 @@ }, | ||
catch (e) { | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (_internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -101,0 +101,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import{__generator as r}from"tslib";import{isSettableDerivable as t,utils as e,lens as n,isDerivable as i}from"@politie/sherlock";var u=Symbol("isDerivableProxy");function o(r){return!0===r[u]}var c=function(){function i(){this.$$derivable=void 0}return Object.defineProperty(i.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,e){if(!e)return r;var i=e.get,u=e.set;return u&&t(r)?n({get:i,set:function(t,e){r.set(u.call(this,t,e))}},r).autoCache():r.derive(i).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(t){throw Object.assign(Error("error while getting "+(r.$expression||"$value")+": "+(t&&t.message)),{jse_cause:t})}},set:function(r){var e=this.$proxyDescriptor,n=e.$derivable,i=e.$expression;if(!t(n))throw Error((i||"$value")+" is readonly");try{n.set(r)}catch(r){throw Object.assign(Error("error while setting "+(i||"$value")+": "+(r&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(t){throw Object.assign(Error("error while getting "+(r.$expression||"$targetValue")+": "+(t&&t.message)),{jse_cause:t})}},set:function(r){var e=this.$proxyDescriptor,n=e.$target,i=e.$expression;if(!t(n))throw Error((i||"$targetValue")+" is readonly");try{n.set(r)}catch(r){throw Object.assign(Error("error while setting "+(i||"$targetValue")+": "+(r&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),i.prototype.$create=function(r,t,n){var i=e.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter((function(r){return r.startsWith("$$")})).forEach((function(r){return i[r]=void 0})),i.$expression=t,i.$path=n,new Proxy(i,f)},i.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),l(t.$expression,r),h(t.$path,r))},i.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},i.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},i.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(a(r))},i.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(a(r))},i.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},i.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(a(r))},i.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},i.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},i.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(i.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),i.prototype[Symbol.iterator]=function(){var t,e,n,i;return r(this,(function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error((n||"object")+" is not iterable"),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},Object.defineProperty(i.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),i}();function a(r){return o(r)?r.$derivable:r}c.prototype[u]=!0;var f={get:function(r,t,e){return"$proxyDescriptor"===t?r:s(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,t,e,n){if(s(r,t)){var u=r.$pluck.call(n,t);return e&&o(e)?u.$targetValue=e.$targetValue:u.$value=e&&i(e)?e.get():e,!0}return Reflect.set(r,t,e,n)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():s(r,t)},getOwnPropertyDescriptor:function(r,t){if(s(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function s(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function l(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function h(r,t){return void 0===r&&(r=[]),r.concat(t)}export{c as ProxyDescriptor,l as extendExpression,h as extendPath,o as isDerivableProxy,a as unwrapProxy}; | ||
import{__generator as r}from"tslib";import{_internal as t,isSettableDerivable as e,utils as n,lens as i,isDerivable as u}from"@politie/sherlock";var o=Symbol("isDerivableProxy");function c(r){return!0===r[o]}var a=function(){function u(){this.$$derivable=void 0}return Object.defineProperty(u.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,t){if(!t)return r;var n=t.get,u=t.set;return u&&e(r)?i({get:n,set:function(t,e){r.set(u.call(this,t,e))}},r).autoCache():r.derive(n).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(e){throw Object.assign(Error("error while getting "+(r.$expression||"$value")+": "+(t.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var n=this.$proxyDescriptor,i=n.$derivable,u=n.$expression;if(!e(i))throw Error((u||"$value")+" is readonly");try{i.set(r)}catch(r){throw Object.assign(Error("error while setting "+(u||"$value")+": "+(t.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(e){throw Object.assign(Error("error while getting "+(r.$expression||"$targetValue")+": "+(t.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var n=this.$proxyDescriptor,i=n.$target,u=n.$expression;if(!e(i))throw Error((u||"$targetValue")+" is readonly");try{i.set(r)}catch(r){throw Object.assign(Error("error while setting "+(u||"$targetValue")+": "+(t.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),u.prototype.$create=function(r,t,e){var i=n.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter((function(r){return r.startsWith("$$")})).forEach((function(r){return i[r]=void 0})),i.$expression=t,i.$path=e,new Proxy(i,s)},u.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),h(t.$expression,r),b(t.$path,r))},u.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},u.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},u.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(f(r))},u.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(f(r))},u.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},u.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(f(r))},u.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},u.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},u.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(u.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),u.prototype[Symbol.iterator]=function(){var t,e,n,i;return r(this,(function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error((n||"object")+" is not iterable"),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},Object.defineProperty(u.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),u}();function f(r){return c(r)?r.$derivable:r}a.prototype[o]=!0;var s={get:function(r,t,e){return"$proxyDescriptor"===t?r:l(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,t,e,n){if(l(r,t)){var i=r.$pluck.call(n,t);return e&&c(e)?i.$targetValue=e.$targetValue:i.$value=e&&u(e)?e.get():e,!0}return Reflect.set(r,t,e,n)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():l(r,t)},getOwnPropertyDescriptor:function(r,t){if(l(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function l(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function h(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function b(r,t){return void 0===r&&(r=[]),r.concat(t)}export{a as ProxyDescriptor,h as extendExpression,b as extendPath,c as isDerivableProxy,f as unwrapProxy}; | ||
//# sourceMappingURL=sherlock-proxy.esm.min.js.map |
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SherlockProxy = {}, global.Sherlock)); | ||
}(this, (function (exports, sherlock) { 'use strict'; | ||
})(this, (function (exports, sherlock) { 'use strict'; | ||
@@ -97,3 +97,3 @@ /*! ***************************************************************************** | ||
// istanbul ignore next: for debug purposes | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -112,3 +112,3 @@ }, | ||
catch (e) { | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -130,3 +130,3 @@ }, | ||
// istanbul ignore next: for debug purposes | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -145,3 +145,3 @@ }, | ||
catch (e) { | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (sherlock._internal.isError(e) && e.message)), { jse_cause: e }); | ||
} | ||
@@ -374,3 +374,3 @@ }, | ||
}))); | ||
})); | ||
//# sourceMappingURL=sherlock-proxy.umd.js.map |
@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@politie/sherlock")):"function"==typeof define&&define.amd?define(["exports","@politie/sherlock"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SherlockProxy={},e.Sherlock)}(this,(function(e,t){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var r=Symbol("isDerivableProxy");function n(e){return!0===e[r]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var e=this.$proxyDescriptor;return e.$$derivable||(e.$$derivable=function(e,r){if(!r)return e;var n=r.get,i=r.set;return i&&t.isSettableDerivable(e)?t.lens({get:n,set:function(t,r){e.set(i.call(this,t,r))}},e).autoCache():e.derive(n).autoCache()}(e.$target,e.$lens&&e.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var e=this.$proxyDescriptor;try{return e.$derivable.get()}catch(t){throw Object.assign(Error("error while getting "+(e.$expression||"$value")+": "+(t&&t.message)),{jse_cause:t})}},set:function(e){var r=this.$proxyDescriptor,n=r.$derivable,i=r.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$value")+" is readonly");try{n.set(e)}catch(e){throw Object.assign(Error("error while setting "+(i||"$value")+": "+(e&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var e=this.$proxyDescriptor;try{return e.$target.get()}catch(t){throw Object.assign(Error("error while getting "+(e.$expression||"$targetValue")+": "+(t&&t.message)),{jse_cause:t})}},set:function(e){var r=this.$proxyDescriptor,n=r.$target,i=r.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$targetValue")+" is readonly");try{n.set(e)}catch(e){throw Object.assign(Error("error while setting "+(i||"$targetValue")+": "+(e&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(e,r,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=e,Object.getOwnPropertyNames(i).filter((function(e){return e.startsWith("$$")})).forEach((function(e){return i[e]=void 0})),i.$expression=r,i.$path=n,new Proxy(i,u)},e.prototype.$pluck=function(e){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(e),f(t.$expression,e),a(t.$path,e))},e.prototype.$pluckableKeys=function(){var e=this.$proxyDescriptor.$value;return"object"==typeof e?Reflect.ownKeys(e):[]},e.prototype.$length=function(){var e=this.$proxyDescriptor.$targetValue;return Array.isArray(e)?e.length:void 0},e.prototype.$and=function(e){return this.$proxyDescriptor.$derivable.and(o(e))},e.prototype.$or=function(e){return this.$proxyDescriptor.$derivable.or(o(e))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(e){return this.$proxyDescriptor.$derivable.is(o(e))},e.prototype.$derive=function(){var e=this.$proxyDescriptor.$derivable;return e.derive.apply(e,arguments)},e.prototype.$react=function(e,t){return this.$proxyDescriptor.$derivable.react(e,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var e,t,r,n;return function(e,t){var r,n,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,n=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!((i=(i=u.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=t.call(e,u)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(i){switch(i.label){case 0:if(e=this.$proxyDescriptor,void 0===(t=e.$length()))throw r=e.$expression,Object.assign(Error((r||"object")+" is not iterable"),{value:e.$value,expression:r});n=0,i.label=1;case 1:return n<t?[4,e.$pluck(n)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function o(e){return n(e)?e.$derivable:e}i.prototype[r]=!0;var u={get:function(e,t,r){return"$proxyDescriptor"===t?e:c(e,t)?e.$pluck.call(r,t):Reflect.get(e,t,r)},set:function(e,r,i,o){if(c(e,r)){var u=e.$pluck.call(o,r);return i&&n(i)?u.$targetValue=i.$targetValue:u.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(e,r,i,o)},has:function(e,t){return t===Symbol.iterator?void 0!==e.$length():c(e,t)},getOwnPropertyDescriptor:function(e,t){if(c(e,t))return{get:function(){return this[t]},set:function(e){this[t]=e},configurable:!0,enumerable:!0}},ownKeys:function(e){return e.$pluckableKeys()}};function c(e,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(e,t)}function f(e,t){return void 0===e&&(e=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?e+"."+t:"string"==typeof t?e+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':e+"["+t+"]"}function a(e,t){return void 0===e&&(e=[]),e.concat(t)}e.ProxyDescriptor=i,e.extendExpression=f,e.extendPath=a,e.isDerivableProxy=n,e.unwrapProxy=o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
***************************************************************************** */var r=Symbol("isDerivableProxy");function n(e){return!0===e[r]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var e=this.$proxyDescriptor;return e.$$derivable||(e.$$derivable=function(e,r){if(!r)return e;var n=r.get,i=r.set;return i&&t.isSettableDerivable(e)?t.lens({get:n,set:function(t,r){e.set(i.call(this,t,r))}},e).autoCache():e.derive(n).autoCache()}(e.$target,e.$lens&&e.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var e=this.$proxyDescriptor;try{return e.$derivable.get()}catch(r){throw Object.assign(Error("error while getting "+(e.$expression||"$value")+": "+(t._internal.isError(r)&&r.message)),{jse_cause:r})}},set:function(e){var r=this.$proxyDescriptor,n=r.$derivable,i=r.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$value")+" is readonly");try{n.set(e)}catch(e){throw Object.assign(Error("error while setting "+(i||"$value")+": "+(t._internal.isError(e)&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var e=this.$proxyDescriptor;try{return e.$target.get()}catch(r){throw Object.assign(Error("error while getting "+(e.$expression||"$targetValue")+": "+(t._internal.isError(r)&&r.message)),{jse_cause:r})}},set:function(e){var r=this.$proxyDescriptor,n=r.$target,i=r.$expression;if(!t.isSettableDerivable(n))throw Error((i||"$targetValue")+" is readonly");try{n.set(e)}catch(e){throw Object.assign(Error("error while setting "+(i||"$targetValue")+": "+(t._internal.isError(e)&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(e,r,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=e,Object.getOwnPropertyNames(i).filter((function(e){return e.startsWith("$$")})).forEach((function(e){return i[e]=void 0})),i.$expression=r,i.$path=n,new Proxy(i,u)},e.prototype.$pluck=function(e){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(e),f(t.$expression,e),a(t.$path,e))},e.prototype.$pluckableKeys=function(){var e=this.$proxyDescriptor.$value;return"object"==typeof e?Reflect.ownKeys(e):[]},e.prototype.$length=function(){var e=this.$proxyDescriptor.$targetValue;return Array.isArray(e)?e.length:void 0},e.prototype.$and=function(e){return this.$proxyDescriptor.$derivable.and(o(e))},e.prototype.$or=function(e){return this.$proxyDescriptor.$derivable.or(o(e))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(e){return this.$proxyDescriptor.$derivable.is(o(e))},e.prototype.$derive=function(){var e=this.$proxyDescriptor.$derivable;return e.derive.apply(e,arguments)},e.prototype.$react=function(e,t){return this.$proxyDescriptor.$derivable.react(e,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var e,t,r,n;return function(e,t){var r,n,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,n=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!((i=(i=u.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=t.call(e,u)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(i){switch(i.label){case 0:if(e=this.$proxyDescriptor,void 0===(t=e.$length()))throw r=e.$expression,Object.assign(Error((r||"object")+" is not iterable"),{value:e.$value,expression:r});n=0,i.label=1;case 1:return n<t?[4,e.$pluck(n)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function o(e){return n(e)?e.$derivable:e}i.prototype[r]=!0;var u={get:function(e,t,r){return"$proxyDescriptor"===t?e:c(e,t)?e.$pluck.call(r,t):Reflect.get(e,t,r)},set:function(e,r,i,o){if(c(e,r)){var u=e.$pluck.call(o,r);return i&&n(i)?u.$targetValue=i.$targetValue:u.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(e,r,i,o)},has:function(e,t){return t===Symbol.iterator?void 0!==e.$length():c(e,t)},getOwnPropertyDescriptor:function(e,t){if(c(e,t))return{get:function(){return this[t]},set:function(e){this[t]=e},configurable:!0,enumerable:!0}},ownKeys:function(e){return e.$pluckableKeys()}};function c(e,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(e,t)}function f(e,t){return void 0===e&&(e=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?e+"."+t:"string"==typeof t?e+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':e+"["+t+"]"}function a(e,t){return void 0===e&&(e=[]),e.concat(t)}e.ProxyDescriptor=i,e.extendExpression=f,e.extendPath=a,e.isDerivableProxy=n,e.unwrapProxy=o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=sherlock-proxy.umd.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
229814